[concurrency-interest] Re: synchronized vs ReentrantLock semantic
dl at cs.oswego.edu
Mon Jun 13 19:59:51 EDT 2005
Dawid Kurzyniec wrote:
> Great! So, what's the final answer on ReentrantReadWriteLock? Is it OK
> to use it to share non-volatiles then? Technically, RWLock is not a
Yes, it is (rrwl.readLock() returns a Lock), and yes it does.
> BTW. Being too lazy to analyze the new JMM semantics just now, whilst
> still curious, let me ask: is it that the volatile read/write, performed
> by the AbstractQueuedSynchronizer, has implicit memory synchronization
Well, it has explicit memory effects :-)
In general, a volatile read acts in the same was as entry into a
synchronized block with respect to the memory model (NOT with respect to
exclusion). And a volatile acts in same way as exit from block.
More information about the Concurrency-interest