Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Mar 2003 16:57:11 -0800 (PST)
From:      Julian Elischer <julian@elischer.org>
To:        "Brian F. Feldman" <green@FreeBSD.org>
Cc:        John Baldwin <jhb@FreeBSD.org>, src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern kern_mutex.c 
Message-ID:  <Pine.BSF.4.21.0303041650310.42494-100000@InterJet.elischer.org>
In-Reply-To: <200303042149.h24LnKSQ073292@green.bikeshed.org>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 4 Mar 2003, Brian F. Feldman wrote:

> John Baldwin <jhb@FreeBSD.org> wrote:
> >   already own.  The mtx_trylock() will fail however.  Enhance the comment
> >   at the top of the try lock function to explain this.
> >   
> I admit I've never actually had a use for mtx_trylock() but... wouldn't you 
> like to detect it and assert against it if you're not expecting it?  If 
> jlemon's behavior is the only one that relies on that part of the semantics, 
> perhaps it should be another kind of mtx_trylock() call.  I guess the real 
> question is just whether or not the assert would ever have done good for 
> anyone while working.



It's a bit late, but it seems a it !POLA to have mtx_try_lock() fail in
a situation where mtx_lock() would succeed. ?

I have used try_lock once, though I eventually did it anouther way.

I have always thougth of try_lock as being
"Try, but instead of sleeping, come back so I can try something else 
instead." The implicit message here is that if 'lock()'
would succeed, try_lock() would succeed..

If you don't want this then maybe it should be called
"try_lock_no_recurse()" or something..
Or maybe the lock should be labled as non-recursive, so that 
the normal lock fails as well.


Julian



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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