in reply to Re: Launching multiple commands in parallel
in thread Launching multiple commands in parallel

But wait doesn't support flags and will therefore pend until a child exits. So if you want to do something in the meantime, forget it -- you have to wait until at least one of your children is done. The way we used to do this in C was to keep track of our children's PIDs, then waitpid across the set without pending to reap any that were done. We'd work that into whatever processing we wanted to do while the children were running.

I haven't done the same thing in Perl though so there may be a better way. Threads are another excellent model for doing this sort of thing but I haven't used them in Perl.

  • Comment on Re: Re: Launching multiple commands in parallel

Replies are listed 'Best First'.
Re: Re: Re: Launching multiple commands in parallel
by dash2 (Hermit) on Mar 06, 2002 at 18:04 UTC
    I believe you can do waitpid(-1, &WNOHANG) to wait for all child processes. On some platforms.

    dave hj~