I haven't gotten it reliably working either way, can you give a working example?Well, it depends rather on what exactly you are referring to as it, but
use threads; use threads::shared; sub X::DESTROY { warn "X::DESTROY(@_)\n" } my $x = bless [], 'X'; share $x; $x->[0] = 1; sub f { $x->[0]++; warn "x->[0] = $x->[0]\n"; } threads->new(\&f)->join for 1..5; __END__ $ perl587t /tmp/p x->[0] = 2 X::DESTROY(X=ARRAY(0x9d8b218)) x->[0] = 3 X::DESTROY(X=ARRAY(0x9da0500)) x->[0] = 4 X::DESTROY(X=ARRAY(0x9da0500)) x->[0] = 5 X::DESTROY(X=ARRAY(0x9da0500)) x->[0] = 6 X::DESTROY(X=ARRAY(0x9da0500)) X::DESTROY(X=ARRAY(0x9cd3c30))
Dave.
In reply to Re^4: Annoying threads share problem!
by dave_the_m
in thread Annoying threads share problem!
by Ace128
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |