[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoiding locks

From: Jeff Sturm
Subject: Re: Avoiding locks
Date: Tue, 29 Jul 2003 14:10:11 -0400 (EDT)

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.

It is known to be broken with respect to the Java memory model.  (In
practice the failure is unlikely to manifest except on certain

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]