This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/22337] pthread_join incorrectly fails for a detached running thread

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
                 CC|                            |carlos at redhat dot com

--- Comment #8 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Andreas Schwab from comment #7)
> It says that pthread_detach has the same effect as PTHREAD_CREATE_DETACHED.

I agree with Andreas, it is the principle of least surprise. 

Once you call pthread_detach() it *should* behave as if you'd started the

This means pthread_join returns EINVAL (thread is not joinable) as soon as
pthread_detach finishes setting joinid to itself.

The other thing to consider is this: What happens if you call pthread_detach()
*while* another thread is already waiting? (this is mentioned in the comments
in pthread_detach).

I think the only bug is that a pthread_join *before* a pthread_detach should
result in pthread_detach returning EINVAL, but right now it looks like we
return 0 (just looking at the code, would need a test case for this).

You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]