[concurrency-interest] Re: synchronized vs ReentrantLock semantic
dholmes at dltech.com.au
Mon Jun 13 23:38:21 EDT 2005
Gregg Wonderly wrote:
> Okay, then this is sure not clear to me either. I guess I'm really
> confused now. I would suggest there should be some even more explicit
> wording about all the specific steps and the specific ties into the
> memory model.
Where has this confusion arisen?
Locks are intended as a direct alternative for use of synchronized
blocks/methods. Hence the Lock interface specifies:
"All Lock implementations must enforce the same memory synchronization
semantics as provided by the built-in monitor lock:
- A successful lock operation acts like a successful monitorEnter action
- A successful unlock operation acts like a successful monitorExit action "
Has the confusion arisen by trying to figure out how this is actually
achieved for a given Lock implementation? Or is the whole JMM so confusing
that anything related to it causes confusion?
This aspect of things was meant to be a "no-brainer" - you shouldn't be
worrying about the details. Some of the comments in that forum thread are
scary! - people are delving into unneccessary detail far too much.
More information about the Concurrency-interest