Re: Compiler ordering barriers in C++0x
  Home FAQ Contact Sign in
comp.lang.c++.moderated only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: Compiler ordering barriers in C++0x         

Group: comp.lang.c++.moderated · Group Profile
Author: Chris Thomasson
Date: May 4, 2008 15:20

"Dmitriy V'jukov" gmail.com> wrote in message
news:c5199756-8669-419e-84e9-1de582eff02e@y38g2000hsy.googlegroups.com...
[...]
> I can prove that I have happens-before relation if I can enforce
> correct compiler ordering. Consider following code:
>
> std::vector g_nonatomic_user_data;
> std::atomic_int g_atomic1;
> std::atomic_int g_atomic2;
>
> std::vector thread()
> {
> g_atomic1.store(1, std::memory_order_relaxed);
> // compiler store-load fence
> if (g_atomic2.load(std::memory_order_relaxed))
[...]

Are you sure that atomic store with 'memory_order_relaxed' semantics injects
a #StoreLoad after the operation?

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
no comments
diggit! del.icio.us! reddit!