axl163 has asked for the wisdom of the Perl Monks concerning the following question:
It appears that my $pid = $pm->start and next; launches the children almost instantaneously and my sleep is executed after all the children have launched. If this is the case, how do I limit and control the launching of children processes. Any advice would be greatly appreciated. Thanks.my $count = 0; foreach (@temp_files) { $count++; print "$program run #$count with temp file \"$_\"...\n"; my $pid = $pm->start and next; system("$program < $_ &"); #Run program located in $PATH sleep 3; if (($count%2) == 0) { print "even run number\n"; #somehow wait for the 2 children processes #$pm -> wait_all_children()? } $pm->finish; # Terminates the child process }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How would I add a pause b/t forks in <code>my $pid = $pm->start and next;</code>
by samtregar (Abbot) on Oct 27, 2005 at 17:39 UTC | |
Re: How would I add a pause b/t forks in my $pid = $pm->start and next;
by jasonk (Parson) on Oct 27, 2005 at 17:48 UTC | |
Re: How would I add a pause b/t forks in my $pid = $pm->start and next;
by salva (Canon) on Oct 27, 2005 at 18:41 UTC | |
by samtregar (Abbot) on Oct 27, 2005 at 21:50 UTC | |
by salva (Canon) on Oct 28, 2005 at 08:03 UTC | |
by samtregar (Abbot) on Oct 28, 2005 at 17:54 UTC |