Created
October 20, 2010 18:16
-
-
Save cornet/636987 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub sig_child_handler { | |
while ( ( $SIGCHLD_PID = waitpid( -1, WNOHANG ) ) > 0 ) { | |
E3::dbprint("caught $SIGCHLD_PID\n" ) if $E3::DEBUG; | |
if (exists $childPID{$SIGCHLD_PID}) { | |
delete $childPID{$SIGCHLD_PID}; | |
if ($children_spawned > 0) { | |
E3::dbprint("decrement children_spawned counter\n" ) if $E3::DEBUG; | |
} | |
} else { | |
E3::dbprint("not our child\n" ) if $E3::DEBUG; | |
} | |
} | |
$children_spawned = scalar(keys(%childPID)); | |
$SIG{CHLD} = \&sig_child_handler; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment