On Tue, 29 Jul 2003, Sascha Brawer wrote: > vaguely related to the current thread about "Thread/VMThread proposal" on > the Classpath discussion list, I would like to ask whether the following > pattern is correct with respect to the Java memory model. I believe so, > but I would like to be sure.
This is an example of the double-checking idiom. http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html It is known to be broken with respect to the Java memory model. (In practice the failure is unlikely to manifest except on certain multiprocessors.) As I understand it, if the proposal in JSR 133 is adopted, it will be sufficient to declare the result field "volatile" for conforming VMs. Jeff _______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath