Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: mysterious threads::shared behaviour

by dave_the_m (Monsignor)
on Jan 18, 2009 at 13:09 UTC ( #737144=note: print w/replies, xml ) Need Help??

in reply to mysterious threads::shared behaviour

threads::shared uses a mechanism similar to tying, so if you do $x = $h{$_}, then $x isn't a reference to a hash, its a reference to an 'LV' scalar variable, who's action on being accessed is to call the appropriate method that gets or stores a value in the real shared hash (with suitable locking). These LV scalars are temporaries created on demand and freed when no longer used, so you are likely to see address re-use.


  • Comment on Re: mysterious threads::shared behaviour

Replies are listed 'Best First'.
Re^2: mysterious threads::shared behaviour
by ericatkin (Novice) on Jan 21, 2009 at 20:22 UTC
    So, that explains it. Thank you. I worked around the XML::Dumper issue with the following code:
    my %tmp_h; for (keys(%h)) { $tmp_h{$_} = {}; %{$tmp_h{$_}} = %{$h{$_}}; } pl2xml(\%tmp_h, 'h.xml'); %tmp_h = ();
    Where can I read more about LV scalars?
      Where can I read more about LV scalars?

      Try PerlGuts Illustrated as a starting point. Search down for "SvPVLV" for the explanation for LV scalars, though you'll probably need to go back to the top and read down to understand the information presented under that heading.

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2022-05-24 02:19 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (82 votes). Check out past polls.