Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #1791
| From | Alexander Terekhov <terekhov@web.de> |
|---|---|
| Newsgroups | comp.programming.threads |
| Subject | Re: forcing the compiler to reload from memory with c++0x |
| Date | 2011-01-29 14:49 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <4D441AD1.C4D8EC77@web.de> (permalink) |
| References | (4 earlier) <69d82db7-34be-4de7-86c4-2f39cc1e6df3@m13g2000yqb.googlegroups.com> <4D415CB9.8E64A6AE@web.de> <0f5da3b3-9991-4f19-bc5e-8462b1a9feef@a28g2000vbo.googlegroups.com> <87ei7xxx9f.fsf@justsoftwaresolutions.co.uk> <8022a201-0d7b-471e-b604-68edb11f43f6@n18g2000vbq.googlegroups.com> |
frege wrote: > > On Jan 28, 3:12 am, Anthony Williams <anthony....@gmail.com> wrote: > > frege <gottlobfr...@gmail.com> writes: > > > On Jan 27, 6:53 am, Alexander Terekhov <terek...@web.de> wrote: > > >> frege wrote: > > > > > 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. > > Sorry by "no memory_order_*" I really meant memory_order_relaxed, > which is kind of the anti- memory order in my mind. But like I > replied elsewhere, I didn't see the (at least technical) difference > between an aligned-int and an atomic with memory_order_relaxed. An aligned-int can be read/written bit/byte/part-wise non-atomically. atomic<>'s memory_order_relaxed operation is meant to be atomic. BTW, another shortcoming of C++0x atomic<> is that it doesn't allow to label noncompeting stores/loads/RMWs which don't need atomicity. I mean something like memory_order_relaxed_noncompeting label. The OP's ctor and clear() member function would use it. regards, alexander.
Back to comp.programming.threads | Previous | Next — Next in thread | Find similar | Unroll thread
Re: forcing the compiler to reload from memory with c++0x Alexander Terekhov <terekhov@web.de> - 2011-01-29 14:49 +0100 Re: forcing the compiler to reload from memory with c++0x Dmitriy Vyukov <dvyukov@gmail.com> - 2011-01-29 06:52 -0800
csiph-web