Why does pthread_mutex_destroy check for an in-use mutex?

Florian Weimer fweimer@redhat.com
Wed Jul 1 06:17:42 GMT 2020


This check does not seem to be mandated by POSIX.  As far as I can see,
it is the only place where __nusers is actually used.

Almost the same check can be implemented using __owner, except for the
case of a condition variable mutex that is being waited upon.  There,
the __owner check incorrectly detects the mutex as unused (so
destruction should proceed), although that is not the case.

Thanks,
Florian



More information about the Libc-alpha mailing list