At 8:37 AM +1300 11/14/03, Evan Ireland wrote:
>Bill (and others),
> "In general, a JVM is not allowed to reorder a volatile write with any
> > preceding accesses to shared memory."
>Although I found reference to this in the JMM archives, I could not
>find this statement in the community review 2 JMM document.
>Is it unintentionally missing from the document?
It is not part of the specification. Rather, it is a property that
can be derived from the spec.
If thread 1 performs a volatile write, and thread 2 performs a read
of the same volatile variable and sees the write by thread 1, then
there is a happens-before ordering from all actions before the
volatile write in thread 1 to all the actions that occur after the
volatile read in thread 2.
This ensures the visibility you need.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:53 EDT