I dont understand why there is one more $SIG(CHLD) function inside the while loop . is it necessary?
use POSIX ":sys_wait_h";
sub zombie_reaper {
while ( waitpid( -1, WNOHANG ) > 0 )
{ }
$SIG{CHLD} = \&zombie_reaper;
}
$SIG{CHLD} = \&zombie_reaper;
Start Free Trial