|
|
| No such thing as a small change | |
| PerlMonks |
Re: use Devel::Pointer in threadsby LanX (Saint) |
| on Apr 04, 2021 at 15:04 UTC ( [id://11130810]=note: print w/replies, xml ) | Need Help?? |
|
Well, I think you are trying to break thread safety and now you're getting bitten by undefined behavior. > I know threads::shared can't share deep data structure, according to the docs that's not true, you can share deep data structures as long as you also share any nested reference.
share(VARIABLE) > and any fix for this approach? You can always use shared_clone for read access. And of course you can explicitly share singular scalars inside your nested data structure to allow writing.
shared_clone(REF) If that's not good enough because you can't/don't want to predict the structure of your nested data, you might try Data::Dumper or Data::Dump for serializing it into a shared string. The receiving end can easily unpack it again.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||