Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Alexander Terekhov Newsgroups: comp.programming.threads Subject: Re: forcing the compiler to reload from memory with c++0x Date: Fri, 28 Jan 2011 14:39:20 +0100 Organization: A noiseless patient Spider Lines: 28 Message-ID: <4D42C708.76F505FC@web.de> References: <4d3cee42$0$1209$426a74cc@news.free.fr> <1d21ad0a-db55-460e-aeb6-66f6d19369ea@i13g2000yqe.googlegroups.com> <4d3e2e3f$0$21517$426a34cc@news.free.fr> <4D40A4C7.16E6F9AE@web.de> <4d421fa3$0$1815$426a34cc@news.free.fr> Reply-To: terekhov@web.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx01.eternal-september.org; posting-host="3e4Fotn8NP3CUoQPJwS9VQ"; logging-data="20309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1896gunQ0v907w9bLFVcJ5VVAaMFdD5ke4=" X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en Cancel-Lock: sha1:iNgaywUf0Ovm6AUPBwihmvFpXlU= Xref: csiph.com comp.programming.threads:1849 David Jobet wrote: > > Alexander Terekhov wrote: > > > initial thread: x = y = 0: > > > > thread A: if (x) y = x; > > > > thread B: if (y) x = y; > > > > The final outcome (x | y) != 0 is prohibited without any atomics and its > > memory ordering. > > > > I call that an implied code-conditional hoist-store barrier constraint. > > Hello Alexander, > > I though we needed a memory model precisely because the current spec does > not say anything about threads ! > Since your example is about program correctness in presence of thread, and > our current spec does not say anything about thread, can you elaborate ? I meant C++0x. Under C++0x the example above is valid and has no data races. regards, alexander.