Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!gegeweb.org!eternal-september.org!feeder.eternal-september.org!feed.cnntp.org!news.cnntp.org!not-for-mail From: Anthony Williams Newsgroups: comp.programming.threads Subject: Re: forcing the compiler to reload from memory with c++0x 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> <69d82db7-34be-4de7-86c4-2f39cc1e6df3@m13g2000yqb.googlegroups.com> <87ipx9xxc0.fsf@justsoftwaresolutions.co.uk> <13cdd468-dee2-4dc6-9cf9-cc852db26fc5@d11g2000yql.googlegroups.com> Date: Fri, 28 Jan 2011 09:31:50 +0000 Message-ID: <8762t9xtkp.fsf@justsoftwaresolutions.co.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:h7r1TPWEMe/aKYZVIztKHcnLRlw= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 25 Organization: CNNTP NNTP-Posting-Host: be5afc53.read.cnntp.org X-Trace: DXC=kUo;F1c@kIVhm=^\mJ7;bRWoT\PAgXa?QC]U8mjb]54^31?8ZVJ3gMUGj6PdB418W^I_4@4jCSnG_`5]>C@^QJkV X-Complaints-To: abuse@cnntp.org Xref: csiph.com comp.programming.threads:1809 Dmitriy Vyukov writes: > On Jan 28, 11:10 am, Anthony Williams wrote: > >> That is probably true in principle. Whereas before, compilers were >> probably restricting themselves so that atomic accesses could be written >> with plain variables (possible adorned with volatile), with C++0x they >> know that writes to non-atomic variables do not have to be made visible >> until an atomic operation with memory_order_release or stronger ordering >> occurs, or some other synchronization event such as a mutex lock. > > A bit of formal hair-splitting. > So does it really need to "flush" plain variables on mutex lock? I > would expect that in presence of spuriously failing try_lock it does > not actually need to do that. Not on the lock (which is an acquire), but it will on the unlock (which is a release). Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976