RE: is there a chance for a race condition in pthread_mutex_[un]lock.c?

"Wan-Teh Chang" <[email protected]> Wed, 17 Dec 2003 14:28:56 -0800
Newsgroups gmane.comp.lib.phil
Message-ID <[email protected]>
Perez-Gonzalez, Inaky wrote on 12/17/2003, 7:51 AM:
>> Still makes me nervous that this situation can go undetected. 
> Would it be worth to assert that __owner != 0 on unlock() to 
> catch this case?

I do not think an implementation is required to
detect this programming error unless the mutex
type is PTHREAD_MUTEX_ERRORCHECK.  If it detects
this programming error, pthread_mutex_unlock
should fail with the EPERM error code.

http://www.opengroup.org/onlinepubs/007904975/functions/pthread_mutex_lock.html

Wan-Teh