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


In reply to Will Child Threads block the parent thread? by vishi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.