I came here to correct my code but you have corrected it already :)
Yes, that's the problem. Although I have said in my first post that locking does not help, I have done it wrong.
What I have tried was this:
for(my $i = 0; $i < 100; $i++) { $pm->start and next; (tied $testvr)->shlock; if($testvr >= 5) { $testvr = 0; } $testvr++; (tied $testvr)->shunlock; (tied $testvr)->shlock; print $testvr . "\n"; tied $testvr)->shunlock; $pm->finish; } $pm->wait_all_children;
It does not work correctly. I was locking and unlocking twice. As it was a testing code, I did not care to write locking statement twice, I assumed that it is doing the same thing.
ThanksIn reply to Re^2: IPC::Shareable and Parallel::Forkmanager Question
by anlamarama
in thread IPC::Shareable and Parallel::Forkmanager Question
by anlamarama
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |