in reply to Should I call waitpid when using Parallel::ForkManager to fork in an infinite loop?
That's not a problem. start reaps children as well. Consider the following example:
my $max_children = 5; my $pm = Parallel::ForkManager->new($max_children); for my $i (0..9) { $pm->start and next; #... $pm->finish; } $pm->wait_all_children;
With your infinite loop, it's no different. You'll be reaping child every time you create one (once you've created $max_children children).
It's a bug to use waitpid in a run_on_finish handler since the process has already been reaped by then.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Should I call waitpid when using Parallel::ForkManager to fork in an infinite loop?
by BioLion (Curate) on Aug 16, 2009 at 12:04 UTC | |
by ikegami (Patriarch) on Aug 16, 2009 at 16:54 UTC |