Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 04 Feb 2008 17:17:51 +0100
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        Daniel Eischen <deischen@freebsd.org>
Cc:        cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org, threads@freebsd.org
Subject:   Re: cvs commit: src/include pthread_np.h src/lib/libthr pthread.map src/lib/libthr/thread thr_mutex.c
Message-ID:  <868x20elw0.fsf@ds4.des.no>
In-Reply-To: <Pine.GSO.4.64.0802041042370.13743@sea.ntplx.net> (Daniel Eischen's message of "Mon\, 4 Feb 2008 10\:47\:57 -0500 \(EST\)")
References:  <200802032238.m13McAbf065324@repoman.freebsd.org> <86d4rdgehd.fsf@ds4.des.no> <Pine.GSO.4.64.0802041042370.13743@sea.ntplx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Eischen <deischen@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
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?868x20elw0.fsf>