Date: Sun, 20 Sep 2015 20:29:36 +0200 From: Szabolcs Nagy <nsz@...t70.net> To: musl@...ts.openwall.com Subject: Re: pthread_join stuck in infinite loop * Julien Ramseier <j.ramseier@...il.com> [2015-09-20 20:07:28 +0200]: > pthread_join() never returns when calling it on a detached thread. > I would expect it to return EINVAL instead. > "If a thread is detached, its thread ID is invalid for use as an argument in a call to pthread_detach() or pthread_join()." http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_02 "The behavior is undefined if the value specified by the thread argument to pthread_join() does not refer to a joinable thread." http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_join.html unfortunately historically ppl believed that detecting detached state is possible so the rationale for pthread_join still has "If an implementation detects that the value specified by the thread argument to pthread_join() does not refer to a joinable thread, it is recommended that the function should fail and report an [EINVAL] error." in particular the glibc man page says EINVAL is correctly reported in all cases which i dont think is true: there is a race between the detached thread exiting an join.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.