[concurrency-interest] Re: Re: Improving RWLock compatibility - ownership test

Larry Riedel larryr@saturn.sdsu.edu
29 Nov 2004 23:42:15 -0000


> > I think it should not be an implementation detail.
> > If there will be no choice, I prefer the method does verify
> > the owner, presuming that can be done extremely quickly.
> 
> historically, locks in dl.u.c. did not perform such checks,
> but the expert group decided that the locks in 1.5 should
> do that (it is a rather cheap operation), and they do.

I prefer java.util.concurrent.locks.Lock specify the behavior
of unlock() in this regard, instead of leaving it undefined.
java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock
implements Lock, and its 1.5.0 documentation does not seem
to say what the behavior of its unlock is.  Ideally (for me)
I could just use a Lock reference and know unlock() will
check ownership for me, because the interface says it must.


Larry