in reply to Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100

Start 10 processes, then

$pm->wait_all_children;
  • Comment on Re: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
  • Download Code

Replies are listed 'Best First'.
Re^2: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
by admiral_grinder (Pilgrim) on Dec 01, 2011 at 15:54 UTC
    No, I think what he is trying to do is have 100 children running at the same time max. But when 10 children drop out, start up another 10 until he has gone through 1000 children.

      Ah, I see. Then something like this may help (not tested):

      $pm->run_on_finish( sub { state $counter; start_next_10_processes() unless ++$counter % 10; } );

      I hope not. That simply delays the start of 900 children for no gain. Normally, P::FM works as follows:

      Have 100 children running at the same time max. But when 1 child drops out, start up another until it has gone through 1000 children.