Before you look too hard at that example, here's a correction
of a dumb error:
Initially:
class X {
boolean a = false
volatile Object b = null;
...
}
Thread 1:
a = true; // not false!
b = this; // fields of "this" are now visible.
Thread 2:
while (b == null);
boolean tmp = a;
Question: Is it possible that thread 2 gets a value of false in tmp?
-Doug
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:25 EDT