I don't think waitpid() is useful here since I don't know the order which the jobs will finish
Usually you don't need to reap the children in the same order they finish. Something like...
... will do.for my $pid (@pids) { my $r = waitpid($pid, 0); # do error checking here, and ensure that $r is really $pid }
The only drawback of this approach is that if you run ps on the machine you will see some zombie processes in some cases. It is fully harmless but some people gets nervous when they see zombies!
In reply to Re: subroutines which forks?
by salva
in thread subroutines which forks?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |