That's all fine and dandy, but if you have more than one child, you can lose it in between intermittent calls to wait. Plus, if you use wait, you'll never know WHICH child exited. It will only tell you A child exited. That's not very friendly. For one child, this may be OK, but in most cases, you are dealing with more than one. wait() is NOT OK in any case! waitpid is the ONLY correct way to clean up child processes that are not allowed to become zombies.

Since Perl (built upon C) is an interpreted language, it will never be good with signals, but the least we can do is to use the better function to clean up the zombies! Using wait instead of waitpid is like using kill instead of sigqueue. Sure, it may work in your certain cases, but in the end, it's simply more beneficial to use the function that

  1. returns more information about the condition of the program
  2. allows more programmer extensibly- queued signals vs. unreliable signals/ blocking perhaps forever on wait at the same time creating a zombie vs. the solution to this exact problem
In short, i fail to grasp your argument on why anyone should use wait vs. waitpid. if you think it is bad advice to recommend a better function to get more info on the same problem, then that's something I've never heard before. It is my opinion (and that of Stevens) that wait should be replaced in EVERY case with waitpid simply because it will promote better programming practice. The WNOHANG flag bonus is reason enough to replace wait that might block forever if you've lost a zombie! Thanks for the interesting battle of books, but I'll stick with my waitpid.
AgentM Systems or Nasca Enterprises is not responsible for the comments made by AgentM- anywhere.

In reply to RE: RE (tilly) 4: For all your forking needs.. by AgentM
in thread For all your forking needs.. by reyjrar

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.