in reply to Controlling number of processes Forked
Parallel::ForkManager will take care of all this for you.
Without that, I like to keep track of child pid's with a hash. That lets me call scalar keys %kid for a count of forked kids, delete $kid{+wait} to sleep until another child exits, and delete $kid{+wait} while %kid; to finish. That all makes it unnecessary to modify $SIG{CHLD} unless you have things to do other than sleep while the kids work.
Don't try to manage pid's from piped open that way. Everything's taken care of when the file handle is closed.
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Controlling number of processes Forked
by DrWhy (Chaplain) on Jun 16, 2006 at 17:19 UTC |