If your process gets two or more SIGCHLD signals before
being scheduled, only one signal will arrive. This because
the kernel keeps track of the signals to your process in a
bit vector, one bit per uniq signal.
The solution is to loop, like this:
sub REAPER {
my $pid;
while(( $pid = waitpid(-1, WNOHANG)) > 0) {
# Do stuff
}
$SIG{CHLD} = \&REAPER;
}
Autark.