Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Volatile happens before question Date: Tue, 17 Jan 2012 10:10:30 -0800 Organization: A noiseless patient Spider Lines: 18 Message-ID: References: <09848313-2372-4c23-8f52-fa84c612c100@u32g2000yqe.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 17 Jan 2012 18:10:33 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="2051"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wVO0IwgZyo13AglOwrcn1aYSYMOfgPPA=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: Cancel-Lock: sha1:HajM+y8FwFfBXrm1np/7mnay6y0= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11415 On 1/17/2012 9:21 AM, Knute Johnson wrote: > And if b = 1 could be reordered before a = true then b would be flopping > all over the place because as soon as a = true b would again have to be 0. But those reads and writes could be reordered, couldn't they? The read of "a" could happen after the read of "b", because there's no happens-before relationship there (a is not volatile, nor synchronized in any way). Or is that what you are saying? The actual problem is worse. (And I did in fact fubar my explanation and the my reading of the code. It *is* broken though.) I'm still looking for references, and I might be close. Uno momento....