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!