http://www.perlmonks.org?node_id=11148156


in reply to Re: having a container on perl VMs is good ?
in thread having a container on perl VMs is good ?

Not to detract from your points, threads::shared has synchronization primitives and also ensures that a shared variable is written to by only one thread at a time.

But IMO when you start using / needing these, something went wrong in the overall design already. I prefer to structure my thread code around Thread::Queue, which changes the design to something message-based and which is far easier to reason about than variables that get updated by multiple threads.