in reply to Re: SIGCHLD interrupting accept call?
in thread SIGCHLD interrupting accept call?
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:
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) { } }
Which gives the appropriate effect. However, I'm wondering now if there is a better way of doing it. Any ideas?sub REAPER { my $stiff; while ($stiff=waitpid(-1,WNOHANG)>0) { $waitepid+=$stiff; } }
Thanks a lot!
--ZZamboni
|
|---|