Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^4: Why isn't this code thread-safe? (MCE!)by marioroy (Prior) |
on Nov 19, 2018 at 22:25 UTC ( [id://1226033]=note: print w/replies, xml ) | Need Help?? |
Hi again, Here is the same thing using MCE::Hobo. Similar code, but processes instead.
For modules not multi-process safe, another thing one can do on Unix platforms is having MCE::Hobo default to posix_exit to avoid all END and destructor processing.
Note that the posix_exit option is not recommended if constructing an object inside the worker involving a temp file. In that case one may want the worker to exit normally. Anyway, the posix_exit option is there if needed as a last resort. Taken from the MCE::Hobo manual: Set posix_exit to avoid all END and destructor processing. Constructing MCE::Hobo inside a thread implies 1 or if present CGI, FCGI, Coro, Curses, Gearman::Util, Gearman::XS, LWP::UserAgent, Mojo::IOLoop, Prima, STFL, Tk, Wx, or Win32::GUI. A lot of modules are not multi-process safe and the reason for setting to 1 automatically. Btw, Prima is now multi-process safe recently. Kind regards, Mario
In Section
Seekers of Perl Wisdom
|
|