Better solution (since it allows all keycards to be in use at the same time):
foreach my $user (@users) { $pm->wait_one_child() while !@keycards; <----- my $key = pop(@keycards); $pm->start and next; print "$user took the '$key' key\n"; $pm->finish(0, { key => $key }); } $pm->wait_all_children;
In reply to Re^2: Parallel::ForkManager and stack
by ikegami
in thread Parallel::ForkManager and stack
by marcpascual
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |