in reply to SIG{ALRM} to help kill external program
A couple suggestions from the Perl Cookbook -- not sure if they are what you need but here they are.
16.19 Avoiding Zombie Processes
If you don’t need to record the children that have terminated, use:
$SIG{CHLD} = 'IGNORE';
If you do, use a SIGCHLD handler:
$SIG{CHLD} = \&REAPER; sub REAPER { my $stiff; while (($stiff = waitpid(-1, WNOHANG)) > 0) { # do something with $stiff if you want } $SIG{CHLD} = \&REAPER; # install *after* calling waitpid }
some info on waitpid & WNOHANG:
http://www.mkssoftware.com/docs/man3/waitpid.3.asp
|
---|