cvs commit: src/include pthread_np.h src/lib/libthr pthread.map src/lib/libthr/thread thr_mutex.c

Daniel Eischen deischen at freebsd.org
Mon Feb 4 07:49:19 PST 2008


On Mon, 4 Feb 2008, Dag-Erling Smørgrav wrote:

> "Attilio Rao" <attilio at freebsd.org> writes:
>> Dag-Erling Smørgrav <des at des.no> writes:
>>> I'm having second thoughts about this one.  There is a significant
>>> risk of false positives if the mutex is currently locked by another
>>> thread.  I'm wondering whether to a) change the implementation so it
>>> only returns true if the mutex is owned by the current thread, or b)
>>> change the interface so you can specify a specific thread, or NULL
>>> for "any".
>> Please don't do the latter.  Semantically the right thing to do here
>> is to assert if the curthread owns the lock or not. Any lock should
>> not be interested on what is the state in regard of other locks.
>
> Thank you.  That was my thought as well, but I didn't want to exclude
> the alternative without discussion.

Then please change the API so that it is pthread_mutex_isowned_np().

-- 
DE


More information about the cvs-src mailing list