in reply to Re^5: Graceful shutdowns and Parallel::ForkManager
in thread Graceful shutdowns and Parallel::ForkManager

You speak truthfully regarding $pm->start(), as I am beginning to understand it. As I am currently understanding it (which may still be in error), it appears that routine basically enqueues them by looping thru, performing a non-blocking wait for a child process to terminate while there are more than the maximum number of processes waiting, then proceeds to where it can launch the next one if that maximum number is non-zero.

I want those processes still operating when the alarm occurs to continue naturally if it was only because of the timeout. When that is the cause of the alarm, I reset the maximum number of processes to 0 because a that point I didn't want additional processes to launch, only my current ones to complete.

I haven't tried that test under Windows/cygwin yet, but plan to try, although if the code works and my logic is sound, it will most likely run on a *nix box of some kind. My appreciation also for the responses, because they are being quite helpful.

  • Comment on Re^6: Graceful shutdowns and Parallel::ForkManager

Replies are listed 'Best First'.
Re: Re^6: Graceful shutdowns and Parallel::ForkManager
by RMGir (Prior) on Jul 26, 2002 at 10:28 UTC
    Ah! Now I see where the confusion comes from.

    $pm->start() is a BLOCKING operation.

    It waits until a process slot becomes available then forks and returns.

    The "parent" process gets a return value of 0, so it does next, and goes back to $pm->start.

    When your alarm fires, your eval is interrupted, so no more start calls will be made. So you don't have to worry about more tasks being dispatched, and your running tasks will complete normally since you wait for them.
    --
    Mike