about summary refs log tree commit diff
path: root/arch/arm/bits/user.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-05-05 21:33:58 -0400
committerRich Felker <dalias@aerifal.cx>2018-05-05 21:33:58 -0400
commitcdba6b2562bc5c2078e0e1e6f86c8835a42ae4ff (patch)
treef452bf4d2f4275ae2945ef860826f6640e8fc830 /arch/arm/bits/user.h
parent526e64f54d729947b35fd39129bc86cbc0b5f098 (diff)
downloadmusl-cdba6b2562bc5c2078e0e1e6f86c8835a42ae4ff.tar.gz
musl-cdba6b2562bc5c2078e0e1e6f86c8835a42ae4ff.tar.xz
musl-cdba6b2562bc5c2078e0e1e6f86c8835a42ae4ff.zip
improve joinable/detached thread state handling
previously, some accesses to the detached state (from pthread_join and
pthread_getattr_np) were unsynchronized; they were harmless in
programs with well-defined behavior, but ugly. other accesses (in
pthread_exit and pthread_detach) were synchronized by a poorly named
"exitlock", with an ad-hoc trylock operation on it open-coded in
pthread_detach, whose only purpose was establishing protocol for which
thread is responsible for deallocation of detached-thread resources.

instead, use an atomic detach_state and unify it with the futex used
to wait for thread exit. this eliminates 2 members from the pthread
structure, gets rid of the hackish lock usage, and makes rigorous the
trap added in commit 80bf5952551c002cf12d96deb145629765272db0 for
catching attempts to join detached threads. it should also make
attempt to detach an already-detached thread reliably trap.
Diffstat (limited to 'arch/arm/bits/user.h')
0 files changed, 0 insertions, 0 deletions