This is the mail archive of the glibc-bugs@sourceware.org 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/17463] mutexes owned by a terminated thread are supposed to be owned by an imaginary thread


https://sourceware.org/bugzilla/show_bug.cgi?id=17463

--- 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.

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