Re: advice needed for spinner



Hi,

In the script 'spinner_fork_for_question.pl', you're still calling
Parallel::ForkManager->wait_all_children, which I stated in my
previous e-mail is a blocking call.  Are you going to remove that
method call at some point?

Also, can you simplify 'spinner_fork_for_question.pl'?  You could
remove the e-mail sending bits, and replace it instead with a call to
qx(sleep), or some other external process that will block for a few
seconds, and most likely get the same result.

The script "gtk3_spinner_fork2.pl" worked for me.

Thanks,

Brian

On Wed, May 28, 2014 at 10:00 PM, tsuyoshi okita <825864 gmail com> wrote:
Dear Brian and others,

Thank you for your quick reply, Brian-san.
Instead of forking two process, I've decided to fork only one process for
sending an email,and using run_on_start and run_on_finish for the spinner.
And the same problem still persists. Strange thing is that I added print
"run_on_start" and print "run_on_finish" to each callback subroutines to
make sure they are processed.  They do, but spinners do not respond right.

In other code using Parallel::ForkManager, Spinner worked fine, it spin and
stopped when I expected. but when forked to send an email, spinner gets
grumpy all the sudden.
I attached two test cases, one is a revised but problem still persists code,
and other works sort of fine.

There is other problem I need your guide for.  when I add hide() for spinner
after stop(), spinner does not show at all.  Have you had this problem??

Thank you again.

Tsuyoshi


On 2014年05月29日 12:04, Brian Manning wrote:

Your sample code uses Parallel::ForkManager, and uses the
wait_all_children method to wait for the children to end processing.
 From the Parallel::ForkManager docs:

-begin quote-

wait_all_children

You can call this method to wait for all the processes which have been
forked. This is a blocking wait.

-end quote-

So you are calling a method that says it will block, hence your demo
script is blocking.

Instead of using "wait_all_children" (which blocks), I would look at
using the "run_on_finish" callback method instead, and make the call
to stop the spinner from that callback method.

Thanks,

Brian

On Wed, May 28, 2014 at 7:27 PM, tsuyoshi okita <825864 gmail com> wrote:

Dear gurus,

I've been trying let a spinner spins at the same time sending an email by
forking and failing.  Although a program forks, and one child process
suppose to spin the spinner while other sends email, the spinner does not
spin until the email is completely sent.  How does you all usually handle
this spinner thingy???  Am i on a right path??

I attached my test case.  You need to add SMTP host name, your email
address, and password.

Thank you.

Tsuyoshi

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list



_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]