#8836: pthread_join on a detached pthread crashes --------------------------+------------------------------ Reporter: 0x0dev | Owner: nobody Type: bug | Status: new Priority: normal | Milestone: R1 Component: System/POSIX | Version: R1/Development Keywords: | Blocked By: Blocking: | Has a Patch: 0 Platform: All | --------------------------+------------------------------ pthread_join should return EINVAL if the thread cannot be joined. - http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_join.html A thread in a detached state cannot be joined - http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_attr_setdetachstate.html It would appear that the correct behavior would be to modify the pthread_join implementation to return EINVAL if the caller attempts to join a detached thread. Attached is an excerpt from a POSIX compatibility test that covers this specific functionality. (2-1.c). This test crashes on rev 44457, producing the error in backtrack.txt. Attached is also a patch to amend pthread_join's behavior. -- Ticket URL: <http://dev.haiku-os.org/ticket/8836> Haiku <http://dev.haiku-os.org> Haiku - the operating system.