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

Dag-Erling Smørgrav des at des.no
Mon Feb 4 08:17:59 PST 2008


Daniel Eischen <deischen at freebsd.org> writes:
> I thought you wanted to know if it was locked regardless of who locked
> it.

Uh, no, that was not the intention.

> If you want to know if the current thread has it locked, it should be
> called pthread_mutex_isowned_np().

I don't see why one would be more correct than the other...

> I don't really see the utility in any other behavior, and almost
> question the need for _isowned.

It is extremely useful when debugging threaded code, as evidenced by the
numerous *_LOCKED macros that are used throughout the kernel.  Those
macros saved me a lot of time and aggravation when I made procfs and
linprocfs MPSAFE, for instance, and I am working on userland code at the
moment which would benefit greatly from the ability to assert that the
appropriate mutex is locked at the entry of a function that accesses or
modifies the corresponding data structure.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the cvs-src mailing list