Then your rule of thumb is wrong. "Only require the unsafe modules you need in child threads" doesn't make sense. Requiring a module in one thread loads it for the entire process. Perhaps you misstated what you meant?
Or not:
$ cat Mod.pm package Mod; print __PACKAGE__, "\n"; 1; $ perl -Mthreads -e'my @t = map { async { require Mod; }; } 1..2; $_-> +join() for @t;' Mod Mod
In reply to Re^4: Semaphores failing to prevent race condition
by ikegami
in thread Semaphores failing to prevent race condition
by Llew_Llaw_Gyffes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |