Drat I forgot to apply the fix to the second example:
> Should have read:
> x=8 w=2 r1=v
> v=1 x=9 r2=x
> r3=w
>
> Can r1==1, r3==0 but r2==9?
Again applying the "roach motel" principle the r2=x can move after the
volatile read r3=w, hence we could have the following:
x=8
v=1
r1=v
r3=w
w=2
x=9
r2=x
So yes we can get the result: r1==1, r3==0 but r2==9
I'm sure Bill or Jeremy will jump on me soon if I've mixed up the
allowed reorderings across volatile reads/writes.
David Holmes
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:49 EDT