This is the mail archive of the
mailing list for the glibc project.
[Bug nptl/17463] mutexes owned by a terminated thread are supposed to be owned by an imaginary thread
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 24 Oct 2017 22:47:00 +0000
- Subject: [Bug nptl/17463] mutexes owned by a terminated thread are supposed to be owned by an imaginary thread
- Auto-submitted: auto-generated
- References: <email@example.com/bugzilla/>
--- Comment #2 from Rich Felker <bugdal at aerifal dot cx> ---
One relatively inexpensive way to resolve conformance here is to have threads
keep (in the TCB/TLS) a count of the number of recursive or error-checking
mutexes they currently one which are not robust. Then, at thread exit time, if
the count is not zero, instead of SYS_exit, the thread can zero out its TID,
futex_wake it, and go into an infinite SYS_pause loop with all signals blocked.
This in effect reserves the TID against reuse. Of course it wastes resources in
programs where threads exit with mutexes locked, but the impact on performance
is minimal, and such programs are arguably buggy anyway (certainly so if they
do it an unbounded number of times, since to do so they'd be creating an
unbounded number of mutexes which are not destroyable).
You are receiving this mail because:
You are on the CC list for the bug.