|
Message-ID: <20170801225602.GE1627@brightrain.aerifal.cx> Date: Tue, 1 Aug 2017 18:56:02 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: [PATCH] thread: do not attempt to join detached threads in pthread_join() On Tue, Aug 01, 2017 at 10:46:13PM +0000, William Pitcock wrote: > A thread which is detached releases it's resources and TCB upon thread termination. > Therefore a thread which is detached is not joinable as any underlying futex will not > be incremented, resulting in a deadlock. Accordingly, we return EINVAL instead of > attempting to wait on a detached thread. > > Other pthread implementations such as glibc NPTL and FreeBSD also reject attempts > to join detached threads with EINVAL. Since the behavior is undefined and *can't be defined* in the general case (where the detached thread may already have exited and its id may even have been reused for a new thread), if any change is to be made, the function should be made to crash in this case. Returning EINVAL hides the (serious) programming error. Rich
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.