[concurrency-interest] Re: synchronized vs ReentrantLock semantic

Gregg Wonderly gregg at cytetech.com
Mon Jun 13 23:16:40 EDT 2005



David Holmes wrote:
>>Gregg Wonderly wrote:
>>When you use this lock to protect reading and writing of other values,
>>those values must be volatile if you want their changed state to
>>propagate between threads/processors etc.
> 
> 
> Absolutely NOT! You do not need to have the shared data that is protected by
> a Lock - any kind - be declared volatile. The Lock implementations take care
> of all the required memory model semantics.
> 
> Sorry Gregg but I have to make sure this misconception is entirely squashed
> (both here are on the referenced forum).

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.

I guess I need to go back and reread some things to glean what I seem to 
have forgot or overlooked...

My profuse appologies for making such a misstatement...

Gregg


More information about the Concurrency-interest mailing list