You wait in the child instead of in the parent. You might want to look at something like Parallel::ForkManager to handle this kind of thing for you. Otherwise, the easiest thing to do is wait 16 times outside the loop to collect all the children.
You might also want to keep track of all the child PIDs so you can tell which you've reaped and which are still hanging around. If something is taking too long, it might be helpful to be able to kill it.
In reply to Re: Fork and wait question
by kyle
in thread Fork and wait question
by chris68805
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |