Subject: | run_on_finish wait_children before starting a new one |
I use PFM 1.07 (latest).
I have a long running "run_on_finish" that write in a lot of files the result of the children. This can take times.
All of the children finish almost at the same times, and then the parent will start closing them before starting a new fork.
The relevant code is :
sub start {
...
while ($s->{max_proc} && ( keys %{ $s->{processes} } ) >= $s->{max_proc}) {
$s->on_wait;
$s->wait_one_child(defined $s->{on_wait_period} ? &WNOHANG : undef);
};
$s->wait_children;
...
}
The $s->wait_children will remove all of them before starting new child.
By removing this, the tests still works, and now child are forking as soon as possible. That speed up a lot the "run_on_finish".