"...guarantee no duplicates..."
Sure can i - in this case ;-)
But the code works with dups, whether i use lock or not.
I tried this:
sub process { my $number = shift; # lock %result; $result{ threads->tid() } = shared_clone( { $number => factorial($number) } ); $semaphore->up; }
It works as expected:
./semaphore.pl 0.0276410579681396 { # tied threads::shared::tie 1 => { # tied threads::shared::tie 10 => 3628800, }, 2 => { # tied threads::shared::tie 10 => 3628800, }, 3 => { # tied threads::shared::tie 10 => 3628800, }, 4 => { # tied threads::shared::tie 11 => 39916800, }, }
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
In reply to Re^4: Threads From Hell #1: How To Share A Hash
by karlgoethebier
in thread Threads From Hell #1: How To Share A Hash [SOLVED]
by karlgoethebier
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |