Perl: the Markov chain saw | |
PerlMonks |
Re: Replacing closures (to work around threads crash)by BrowserUk (Patriarch) |
on Nov 22, 2004 at 07:28 UTC ( [id://409511]=note: print w/replies, xml ) | Need Help?? |
Is there an alternative way to replace closures with something else? The trouble with your question, beyond that like others, I cannot reproduce your problem, is that your example code doesn't show why you are trying to use closures. That is to say, devoid of the original context, your example code doesn't make any sense (to me). It makes it very hard to recommend an alternative, when it's not clear for what purpose you are trying to use them in the first place. In your example, you are closing over a local, unshared array. That means each thread will get it's own copy of that array. However, it's not clear to me what purpose that array will serve? Examine what is said, not who speaks.
"But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen"Think for yourself!" - Abigail "Time is a poor substitute for thought"--theorbtwo "Efficiency is intelligent laziness." -David Dunham "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
In Section
Seekers of Perl Wisdom
|
|