in reply to Parallel::ForkManager question
This code also incorporates ikegami's comment about how the child can get the parent's pid.my $parent_pid = $$; my @pids; my $pm = new Parallel::ForkManager($MAX_PROCESSES); foreach $data (@all_data) { my $pid = $pm->start; if ($pid) { push(@pids, $pid); next; } # child executes here # ... and pid of parent is in $parent_pid $pm->finish; # child exits here } kill $signal, @pids; # signal children
|
|---|