Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Feb 2008 10:47:57 -0500 (EST)
From:      Daniel Eischen <deischen@freebsd.org>
To:        =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
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:  <Pine.GSO.4.64.0802041042370.13743@sea.ntplx.net>
In-Reply-To: <86d4rdgehd.fsf@ds4.des.no>
References:  <200802032238.m13McAbf065324@repoman.freebsd.org> <86d4rdgehd.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

---559023410-1804928587-1202140077=:13743
Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Mon, 4 Feb 2008, Dag-Erling Sm=C3=B8rgrav wrote:

> Dag-Erling Smorgrav <des@FreeBSD.org> writes:
>>   Log:
>>   Add pthread_mutex_islocked_np(), a cheap way to verify that a mutex is
>>   locked.  This is intended primarily to support the userland equivalent
>>   of the various *_ASSERT_LOCKED() macros we have in the kernel.
>
> 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".

I thought you wanted to know if it was locked regardless of who
locked it.  If you want to know if the current thread has it
locked, it should be called pthread_mutex_isowned_np().

I don't really see the utility in any other behavior, and almost
question the need for _isowned.  I wonder if all the _np() functions
should be in the FBSDprivate namespace...

--=20
DE
---559023410-1804928587-1202140077=:13743--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.0802041042370.13743>