Firstly, you've changed your OP without indicating what you've changed. Please do not do this! It's perfectly OK to edit your nodes but do ensure you clearly mark what you've changed: "How do I change/delete my post?" explains the how and why of this.

"About the 'exit' statement, I have a 'next' in the parent's 'if' statement, so only the child reaches the 'exit'."

The exit statement is still not clearly bound to the child code. The exit statement is still in the subroutine definition. Is there a reason you do not wish to use return.

"The potential 'while' infinite loop - is there a better way to wait for the number of child processes to drop below the max?"

I've already suggested using sleep and alarm. Do you have a problem with that suggestion? If so, what is it?

-- Ken


In reply to Re^3: CHLD handler stopped working by kcott
in thread CHLD handler stopped working by halecommarachel

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.