in reply to Parallel::ForkManager and stack
as been said, it's a race condition.my @keycards= qw(A B C); my @users = qw(peter james john luke andrew judas); ... foreach my $user (@users) { sleep(int(rand(3))); my $key = pop(@keycards); $pm->start and next;
It seems to me this problem could be solved by
or, more generallymy $pm = Parallel::ForkManager->new(2);
All in all, that looks like a fairly questionable, error-prone feature of Parallel::ForkManager (which is a good module otherwise).my $pm = Parallel::ForkManager->new(@keycards - 1);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parallel::ForkManager and stack
by ikegami (Patriarch) on Jan 27, 2016 at 19:00 UTC | |
by Anonymous Monk on Jan 28, 2016 at 02:19 UTC |