fix potential race condition in detached threads
[musl] / src / internal / syscall.c