in reply to Re^2: Threads and Shared Variables
in thread Threads and Shared Variables
and as far as I can tell this should work.
It doesn't. And it won't whether you understand it or not.
In Perl: DO NOT DEFINE SUBROUTINES WITHIN NESTED SCOPES!
Weird bugs happen whether threads are involved or not. And when threads are involved, they can be even weirder. So don't do it.
I could probably eventually explain why it doesn't work, but then I would have to think about it and probably do some experiments. But as there is no good reason to declare subs in async blocks; and many good reasons not to, I cannot be bothered to work out what does or does not work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Threads and Shared Variables
by hermes1908 (Novice) on Jul 04, 2013 at 22:18 UTC | |
by BrowserUk (Patriarch) on Jul 04, 2013 at 22:35 UTC | |
by Arunbear (Prior) on Jul 05, 2013 at 11:25 UTC |