in reply to Re: passing hashes between threads
in thread passing hashes between threads
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: passing hashes between threads
by BrowserUk (Patriarch) on Sep 18, 2011 at 12:52 UTC |