$SIG{CHLD} = sub {while (waitpid(-1, WNOHANG) > 0){} };
AFAIK, on most platforms (where reaping children is of concern), setting
$SIG{CHLD} = 'IGNORE';
should have the same effect, as it will make Perl autoreap terminated child processes. And it's less clutter (you don't need to load/import WNOHANG from POSIX ...).
See also perlipc.
In reply to Re^2: Best way to kill a child process
by Eliya
in thread Best way to kill a child process
by doylebobs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |