Re: Avoiding locks

2003-07-29 Thread Jeff Sturm
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

Re: Avoiding locks

2003-07-29 Thread Sascha Brawer
Jeff Sturm [EMAIL PROTECTED] wrote on Tue, 29 Jul 2003 14:10:11 -0400: http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html Thanks for the great reference. -- Sascha Sascha Brawer, [EMAIL PROTECTED], http://www.dandelis.ch/people/brawer/

RE: Avoiding locks

2003-07-29 Thread David Holmes
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. No the result field is just a local variable - declaring it volatile won't do anything. Sascha's code correctly defined foo as volatile. There is actually