On Sat, 2 Apr 2016, Peter Zijlstra wrote: > On Sat, Apr 02, 2016 at 11:09:20AM -0000, Thomas Gleixner wrote: > > To undo the attachment each involved thread needs to call > > > > pthread_mutex_detach_np(&mutex); > > > > When the last user detaches the kernel state is destroyed. > > So I was fully expecting pthread_mutex_{at,de}tach_np() to not exist and > be internal to pthread_mutex_{init,destroy}(). > > Is there a reason this is not so?
init/destroy are only called once and not on all threads using the futex. If you want to hide that, then you need to add it to all pthread_mutex_* operations and attach on the first call. That's possible, but for simplicity we made it explicit. Thanks, tglx