vishi has asked for the wisdom of the Perl Monks concerning the following question:
Hi Gurus,
I have a program where I am creating 2 child threads from the main thread. I assume(d) that the main thread is supposed to continue doing its work, while the child threads do theirs.
But, in my program, I see that the main thread activities (some print statements, checks, etc.) are not being displayed ...and I see output only from the child threads.
Here's my question : Do the child threads block the main thread from executing until they are "join"ed?
A) If yes, is there a possible way to execute stuff that the main thread is supposed to do in parallel with child threads?
B) If no, then, why am I not seeing any output/activity from the main thread?
C) How can I make the main program do its work along with the child threads?
I have read from Perl Thread Tutorials (http://perldoc.perl.org/perlthrtut.html)that there are different models that can be used - boss/worker model, worker crew model, etc. I don't see any implementation example of these anywhere in perldoc.
Please let me know how I should proceed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Will Child Threads block the parent thread?
by dasgar (Priest) on Feb 27, 2011 at 05:50 UTC | |
by vishi (Beadle) on Feb 27, 2011 at 08:46 UTC | |
by BrowserUk (Patriarch) on Feb 27, 2011 at 09:04 UTC | |
by GrandFather (Saint) on Feb 27, 2011 at 09:39 UTC | |
by dasgar (Priest) on Feb 27, 2011 at 13:38 UTC | |
|
Re: Will Child Threads block the parent thread?
by cdarke (Prior) on Feb 27, 2011 at 05:55 UTC | |
|
Re: Will Child Threads block the parent thread?
by GrandFather (Saint) on Feb 27, 2011 at 05:56 UTC |