Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Reusable threads demo

by zentara (Archbishop)
on Aug 18, 2012 at 08:53 UTC ( [id://988180]=note: print w/replies, xml ) Need Help??


in reply to Re: Reusable threads demo
in thread Reusable threads demo

Hi, unless the threads::shared model has improved a bit lately, you can only pass scalars as shared variables, and when you share a hash, only the top level hash keys can be accessed. So if you try to descend into a shared hashref, you may get bad results on a deep hash. See threads::shared and if you can show a running code example of what you are doing, that would help everyone out.

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^3: Reusable threads demo
by snigavig (Initiate) on Nov 21, 2012 at 12:30 UTC
    Hello, I'm posting here what I did at that time, maybe it becomes handy to someone..:
    share $shash{$dthread}{'go'}; $shash{$dthread}{'go'} = 0; share $shash{$dthread}{'data'}->{'first_key'}; $shash{$dthread}{'data'}->{'first_key'} = ''; share $shash{$dthread}{'data'}->{'second_key'}; $shash{$dthread}{'data'}->{'second_key'} = ''; share $shash{$dthread}{'data'}->{'third_key'}; $shash{$dthread}{'data'}->{'third_key'} = ''; share $shash{$dthread}{'pid'}; $shash{$dthread}{'pid'} = -1; share $shash{$dthread}{'die'}; $shash{$dthread}{'die'} = 0;
    In such case $shash{$dthread}{'data'} becomes a key-value hash. Thank you!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found