c has asked for the wisdom of the Perl Monks concerning the following question:
I'm currently working with the following code base:
for my $i(@nodes) { if ($fork) { if ($pid = fork) { next; } elsif (defined($pid)) { &do_something; exit; } else { warn "Problem found in forking\n"; } } else { &do_something; } } while (wait() != -1) { return 1 if ($?); }
I'm not really sure at all how to achieve want I want in this case. Every solution that I have tried to come up with ends up only forking the first 50 processes and then ends up skipping the remaining in my list as my for loop just continues on its way. Can someone offer a suggestion on how I can accomplish this?
thanks -c
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Limiting the number of forks
by larryk (Friar) on Oct 02, 2002 at 12:21 UTC | |
|
Re: Limiting the number of forks
by bronto (Priest) on Oct 02, 2002 at 12:26 UTC | |
|
Re: Limiting the number of forks
by Abigail-II (Bishop) on Oct 02, 2002 at 13:39 UTC | |
by robartes (Priest) on Oct 02, 2002 at 14:01 UTC | |
by Abigail-II (Bishop) on Oct 02, 2002 at 14:07 UTC | |
by robartes (Priest) on Oct 02, 2002 at 14:22 UTC |