At 3:09 PM -0700 10/25/99, Keith Randall wrote:
>  > An example. Initially, a = b = 0:
>  >
>  > thread 1				thread 2
>  > x = a					y = b
>  > synchronized (new Object()) {}		synchronized (new Object()) {}
>  > b = 1					a = 1
>  >
>  > Under the old model, it would be impossible for this code to result
>  > in x = y = 1. But under the new model, since the synchronized blocks
>  > in the above code are no-ops, it _is legal_ to get a result of x = y
>  > = 1.
>
>Unless I am misinterpreting things, the result x = y = 1 is illegal in
>your new memory model as well.
Oops... You are correct. I'll have to think about this one some more.
>thread 1                            thread 2
>   a = 1                               b = 1
>   synchronized (new Object()) {}      synchronized (new Object()) {}
>   x = b                               y = a
>
>Any of the four possible values are allowed for the pair (x,y) with
>your new memory model, but the pair (0,0) is not allowed for the old
>memory model (but would be allowed by the old model if the
>synchronized statements were taken away).
>
You are correct.
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:21 EDT