If a copy was not made, by the time the reader got a hold of (what?: a reference to) the hash, the feeder will have already overwritten it with the next record. Or worse, partially overwritten it.I understand that. But if I do something like:
sub WorkerThread { while ( $element = $wq->dequeue ) { $hashref = DoWork($element); $qq->enqueue( $hashref ); } } sub DoWork{ my %hash ..... return \%hash; }
Why is the my %hash not doing the trick. It should be new hash-reference every time DoWork() is called. Do I miss something?
In reply to Re^2: passing hashes between threads
by bago
in thread passing hashes between threads
by bago
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |