[concurrency-interest] Assignment of references atomic?

Chris Purcell chris.purcell.39 at gmail.com
Wed Oct 12 18:52:33 EDT 2005


> It is possible for a thread calling getObject in this case to see a 
> partially constructed object; in other words, see an up-to-date value 
> of 'object' but a stale/inconsistent/invalid version of the object's 
> state, because object was not properly published.
>
> In short, no, you cannot do what you want to do.  You have to 
> synchronize.

Just to clarify here: you can synchronize by using the "volatile" 
keyword, right? You do not need to use the "synchronized" keyword?

Cheers,
Chris Purcell



More information about the Concurrency-interest mailing list