in reply to Re: SIGCHLD interrupting accept call?
in thread SIGCHLD interrupting accept call?

Thanks! This works perfectly. That for statement goes to my Perl bag-o-tricks :-)

The only thing that took me a couple of minutes was how to assign the value of $waitepid. Because here's what I had in my signal handler:

sub REAPER { my $stiff; while ($stiff=waitpid(-1,WNOHANG)>0) { } }
Simply replacing $stiff with $waitepid and making it global would not have worked, since the loop is waiting until it is zero or less than zero. So here's what I did:
sub REAPER { my $stiff; while ($stiff=waitpid(-1,WNOHANG)>0) { $waitepid+=$stiff; } }
Which gives the appropriate effect. However, I'm wondering now if there is a better way of doing it. Any ideas?

Thanks a lot!

--ZZamboni