in reply to New Child to Wait for First Child to Die

The `normal' approach to reap children is to use:

while (defined (my $rc = waitpid(-1, &WNOHANG))) { #some child has finished }

Check the perlfunc:waitpid man page for more.

$h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";

Replies are listed 'Best First'.
Re: Re: New Child to Wait for First Child to Die
by spike_hodge (Novice) on Apr 24, 2003 at 09:16 UTC
    while (defined (my $rc = waitpid(-1, &WNOHANG))) { #some child has finished } I don't understand how to use this to stop the main program launching another child untill the first child is dead. Thanks