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


Groups > comp.programming.threads > #1806

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

Path csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!aioe.org!feeder.news-service.com!newsfeed.straub-nv.de!uucp.gnuu.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> <4D415CB9.8E64A6AE@web.de> <0f5da3b3-9991-4f19-bc5e-8462b1a9feef@a28g2000vbo.googlegroups.com>
Date Fri, 28 Jan 2011 08:12:12 +0000
Message-ID <87ei7xxx9f.fsf@justsoftwaresolutions.co.uk> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:E6POkDL+lqE13ZXRUtof2b2suXk=
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Lines 28
Organization CNNTP
NNTP-Posting-Host b6891469.read.cnntp.org
X-Trace DXC=o>G@[mFZ`8@;ledfgJP[KFWoT\PAgXa?AC]U8mjb]54N31?8ZVJ3gMEGj6PdB418WNf5ef5<?DV0O[MO?Yd5@9DF
X-Complaints-To abuse@cnntp.org
Xref csiph.com comp.programming.threads:1806

Show key headers only | View raw


frege <gottlobfrege@gmail.com> writes:

> On Jan 27, 6:53 am, Alexander Terekhov <terek...@web.de> wrote:
>> frege wrote:
>>
>> [...]
>>
>> > Anyhow, I would say that this is one of those rare cases where
>> > volatile is the right answer - you just need to adds lots of code
>>
>> Volatile is not the right answer. atomic<> is the rights answer.
>>
>
> Yes, we still need atomic - in the most basic sense - ie an aligned
> int, for example.  But no memory_order_* instructions are needed.

Well, if you use an atomic<int> then you will need to use
memory_order_relaxed explicitly unless you want the default
memory_order_seq_cst.

If you don't use atomic<int> then you have undefined behaviour.

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 — Next in thread | Find similar | Unroll thread


Thread

Re: forcing the compiler to reload from memory with c++0x Anthony Williams <anthony.ajw@gmail.com> - 2011-01-28 08:12 +0000
  Re: forcing the compiler to reload from memory with c++0x frege <gottlobfrege@gmail.com> - 2011-01-28 19:47 -0800
    Re: forcing the compiler to reload from memory with c++0x Dmitriy Vyukov <dvyukov@gmail.com> - 2011-01-29 01:43 -0800

csiph-web