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

I have read a limitation of P:FM that you cannot define new P:FM until all Child processes from the previous are finished. This limitation is mentioned in CPAN for P::FM. So can any one give another suggestions?
  • Comment on Re^4: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100

Replies are listed 'Best First'.
Re^5: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
by runrig (Abbot) on Dec 01, 2011 at 20:19 UTC
    You can't define another P::FM object within the same process (until all child processes from the previous are terminated...), but you can define a new object in a child process.
Re^5: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
by admiral_grinder (Pilgrim) on Dec 01, 2011 at 20:23 UTC

    Almost:

    You are free to use a new copy of Parallel::ForkManager in the child processes, although I don't think it makes sense.

    What you saw was:

    If you want to use more than one copies of the Parallel::ForkManager, then you have to make sure that all children processes are terminated, before you use the second object in the main program.

    However, I would test it to double check. Using the run_on_finish callback would work. Whether it would be more clear or easier to read is up to the user.