Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: PERL issues a "lock can only be used on shared values" when locking a shared hash

by Anonymous Monk
on Apr 26, 2013 at 03:58 UTC ( #1030757=note: print w/ replies, xml ) Need Help??


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:
my %hash :shared; $hash{'foo'} = 'bar'; #lock($hash{'foo'}); # Error lock(%hash); # Works
lock follows references exactly one level:
my %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;


Comment on Re^3: PERL issues a "lock can only be used on shared values" when locking a shared hash
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030757]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2015-07-28 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls