Jeremy Manson wrote:
> That depends on where one imagines that the write of the default value
> actually occurs. We think of it as an "outside the thread in which is was
> constructed" action, because if we had:
> Thread 1:
> x = 1;
> y = default;
> Thread 2:
> r1 = y
> r2 = x
> And then we said that there was a happens-before edge from the
> write of the
> default value to the read of y, then the read of x would have to see 1.
> This is not our intent.
I don't follow. Just because there is a happens-before edge between y =
default and r1 = y it doesn't mean there is a happens-before edge between x
= 1 and y = default, or between r1 = y and r2 = x. The order of statements
in both or either threads could be switched around.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:04 EDT