in reply to Re: use Devel::Pointer in threads
in thread use Devel::Pointer in threads

I have a reason to attempt this, tho I know I will implement my own lock if this approach works. In fact, I have to assume I cannot predict how will the $Deep grows, but the $Deep can be really deep, like JSON. Child threads will read files and then further extend the structure tree, and every other child will work depends on the current tree to dig what they interest. That's why I can't declare explicitly ahead, nor a clone of the current helps.

I could have a safer approach by using DB, or deploy a thread to implement a TCP socket, so every child talk to the DB/Socket, but I try to use at least of I/O as possible.

Replies are listed 'Best First'.
Re^3: use Devel::Pointer in threads
by LanX (Saint) on Apr 05, 2021 at 11:45 UTC
    Like I already said, I'd rather serialise data into a long string than to depend on undefined behaviour.

    I mentioned Data::Dump* you mentioned JSON, so what's the problem?

    Your trick to bypass "sharing" can segfault in worst case and is unreliable in best case.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery