Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #1795

Re: forcing the compiler to reload from memory with c++0x

Path csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!feed.cnntp.org!news.cnntp.org!not-for-mail
From Anthony Williams <anthony.ajw@gmail.com>
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> <4d4221e9$0$17247$426a74cc@news.free.fr> <947b33d5-2509-4f0c-9256-a7c3de35578e@24g2000yqa.googlegroups.com> <87mxmlxxry.fsf@justsoftwaresolutions.co.uk> <ihv8t6$bmr$1@news.eternal-september.org> <ihvdci$ekh$1@news.eternal-september.org>
Date Sun, 30 Jan 2011 22:00:07 +0000
Message-ID <87k4hmxdaw.fsf@justsoftwaresolutions.co.uk> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:o+CD1eXA+7moIFBT8geHrbKwQ0k=
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Lines 21
Organization CNNTP
NNTP-Posting-Host 1dbafa7a.read.cnntp.org
X-Trace DXC=dmn3b9hXONiFd<l<6;WcijWoT\PAgXa?a1LKeO=ej5Zh31?8ZVJ3gMeGj6PdB418WniDWEWZmNi6ba8\JCd=f3La
X-Complaints-To abuse@cnntp.org
Xref csiph.com comp.programming.threads:1795

Show key headers only | View raw


Andy Venikov <swojchelowek@gmail.com> writes:

> atomic<int> a_int;
> ...
> while (!a_int.get(mode_acquire))
> {
> }
>
> As understand, in this case the compiler in *NOT* allowed to optimize
> the loop away. Am I wrong?

This doesn't actually impose any additional restrictions over
memory_order_relaxed unless the load actually reads a value written by
another thread with memory_order_release (or equivalent) on the store.

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

Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: forcing the compiler to reload from memory with c++0x Andy Venikov <swojchelowek@gmail.com> - 2011-01-28 16:44 -0500
  Re: forcing the compiler to reload from memory with c++0x Anthony Williams <anthony.ajw@gmail.com> - 2011-01-30 22:00 +0000
  Re: forcing the compiler to reload from memory with c++0x Andy Venikov <swojchelowek@gmail.com> - 2011-01-31 14:28 -0500
  Re: forcing the compiler to reload from memory with c++0x Dmitriy Vyukov <dvyukov@gmail.com> - 2011-01-29 01:47 -0800

csiph-web