[concurrency-interest] Re: synchronized vs ReentrantLock semantic

Doug Lea dl at cs.oswego.edu
Mon Jun 13 15:25:02 EDT 2005


>   ReentrantReadWriteLock uses AbstractQueuedSychronizer to 
> manage the locking but that class explicitly states that it does not 
> perform any memory synchronization other than the "state" that it 
> manages 

Which means that if any subclass performs any operation
with memory effects equivalent to a volatile-read
in tryAcquire, and volatile-write in tryRelease, then proper JMM
memory semantics hold. Which they all do.
(It could be ensured in other ways, but this is
the most straightforward way.)

-Doug



More information about the Concurrency-interest mailing list