Fix for issue 11981 - deadlock during thread initialization on Posix

[Issue 11981](https://d.puremagic.com/issues/show_bug.cgi?id=11981): deadlock during thread initialization on Posix