in reply to Re^2: PERL issues a "lock can only be used on shared values" when locking a shared hash
in thread PERL issues a "lock can only be used on shared values" when locking a shared hash
.... Seriously.
so you've read threads::shared? Cause it gives examples
You cannot lock the individual elements of a container variable:lock follows references exactly one level:my %hash :shared; $hash{'foo'} = 'bar'; #lock($hash{'foo'}); # Error lock(%hash); # Worksmy %hash :shared; my $ref = \%hash; lock($ref); # This is equivalent to lock(%hash)
lock %{ $uber_hashRef{'%y'} };
is like my $ref = $uber_hashRef{'%y'}; lock $ref;
is like my $ref = $uber_hashRef{'%y'}; lock %$ref;
In Section
Seekers of Perl Wisdom