[cpp-threads] C++ memory model

Nelson, Clark clark.nelson at intel.com
Wed Sep 23 01:39:37 BST 2009


> > I think it would be helpful to see an example of a program for which
> > this sentence might be considered relevant.
> 
>     while( x );
> 
> ?
> 
>     while( !x.compare_exchange_weak( &t, t+1 ) );
> 
> ?

OK. Now it's clear what the standard says about the way these are executed in the abstract machine. By what sort of "as-if" logic might an implementation decide it could move the references out of the loop?

Clark



More information about the cpp-threads mailing list