Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: nite of the living dead: perl and stunnel make zombies

by merlyn (Sage)
on Nov 22, 2000 at 03:42 UTC ( #42830=note: print w/replies, xml ) Need Help??


in reply to Re: nite of the living dead: perl and stunnel make zombies
in thread nite of the living dead: perl and stunnel make zombies

That's neither necessary nor sufficient.

The problem is that you might get one SIGCHLD even though more than one child has gone belly up, and thus you aren't waiting long enough.

Either use a double-fork solution (so the kids are effectively orphaned grandkids who become adopted by process #1), or a waitpid loop until there are no more kids to reap at opportune times in your algorithm.

-- Randal L. Schwartz, Perl hacker

  • Comment on Re: Re: nite of the living dead: perl and stunnel make zombies

Replies are listed 'Best First'.
Re: Re: Re: nite of the living dead: perl and stunnel make zombies
by Chmrr (Vicar) on Nov 22, 2000 at 05:10 UTC
    One method to do the latter:
    use POSIX ":sys_wait_h"; SIG{CHLD} = \&REAPER; sub REAPER { 1 while (waitpid(-1,&WNOHANG) != -1); $SIG{CHLD} = \&REAPER; }
    On a somewhat off-topic note, what version of the perldocs (like this one) are the ones on PerlMonks? 5.6's waitpid docs have an example of exactly this, whereas 'tis missing on PerlMonks..
    perl -e 'print "Just use $^X$\"$]!$/"'
      I don't think vroom has reimported the pdocs since 5.6 settled. They are eldritch. =)

      --
      $you = new YOU;
      honk() if $you->love(perl)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://42830]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2023-01-27 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?