Just another Perl shrine | |
PerlMonks |
Re^3: Why isn't this code thread-safe? (MCE!)by BrowserUk (Patriarch) |
on Nov 10, 2018 at 13:18 UTC ( [id://1225535]=note: print w/replies, xml ) | Need Help?? |
I think moving to requireing the module tree in the thread subs is probably compounding the problems. Imagine one thread gets a timeslice, gets part way through loading the module tree and then gets interrupted and another thread starts its attempt to load those same modules. If one of them has global state that is only used during loading, that interruption may leave it in an undefined state and the second thread inherits that state at the C level. If you really want to go that route, you should consider wrapping the require in a critical section to ensure that no two threads can be attempting to load the module tree concurrently. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.
Suck that fhit
In Section
Seekers of Perl Wisdom
|
|