Fix thread posix signal mask

Hello,

As discussed on the mailing list, this patch changes the way the signal mask is set on the worker thread, so there's no chance for a race condition to happen if a signal happens to be handled by the newly created thread before its mask is set (because it inherits the signal mask from its parent).

I've ran the test suite and all tests passed, let me know if you want to see any changes made to this patch.

Cheers!