my $max_children = 10; # max number of children my $num_children = 0; # number we have now foreach $item (@items) { if( my $p = fork() ) { if ($num_children >= $max_children) { $dead_child = wait; $num_children--; } $num_children++; # child count } else { #do some sort of child processing last; # We want out of the loop } }
Edit: 2001-03-03 by neshura
In reply to Re: Re: Forks/Threads
by Anonymous Monk
in thread Forks/Threads
by GoatLove
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |