[concurrency-interest] Assignment of references atomic?

Joe Bowbeer joe.bowbeer at gmail.com
Wed Oct 12 09:19:29 EDT 2005


On 10/12/05, Ryan LeCompte <Ryan.LeCompte at pangonetworks.com> wrote:
>
> I know that assignment of doubles are potentially unsafe since they are 64
> bits, but I was wonder if assignment of object references are atomic in J2SE
> 1.4.2 and J2SE 5.0?
>

The JMM chapter of the JLS says writes and reads of object references
are always atomic.

"Writes to and reads of references are always atomic, regardless of
whether they are implemented as 32 or 64 bit values."

http://java.sun.com/docs/books/jls/third_edition/html/memory.html

Whether unsync'd writes and reads are "safe" is another matter..



More information about the Concurrency-interest mailing list