in reply to Re: Re: Re: OO and Threads conflict?
in thread OO and Threads conflict?
That I couldn't tell you for sure. My guess is that the data IS shared in a way across all threads, but since the reader is only looking at the one instance passed to it, that should be the only data that matters between those two threads, and another instance will generate a separate shared variable in a separate object and so the reader for that object will be looking at different data.
BTW, $hash{key} = \$var stores a reference to the scalar in the hash, and normally to dereference a scalar reference you put a '$' in front of it, but since its in a hash you need to wrap the whole thing with curlies. E.g.
You could probably look through perlref and perlreftut and other reference tutorials...search this site..(sorry don't have any handy).my $var = 1; my $ref = \$var; my %hash = ( key => \$var ); # All print '1' print $var; print $$ref; print ${$hash{key}};
|
|---|