[cpp-threads] Yet another visibility question

Peter Dimov pdimov at mmltd.net
Tue Nov 28 22:06:11 GMT 2006


Ping? :-)

Peter Dimov wrote:
> Another question:
> 
> // x y initially zero
> 
> // threads 1 to N:
> 
> assert( x == 0 );
> 
> if( fetchadd_release( &y, 1 ) == N - 1 )
> {
>    x = 1;
> }
> 
> Are the asserts guaranteed to pass? Informally, the causality
> constraint prevents the compiler or the hardware from speculatively
> executing the store before the fetchadd, even though there's no
> acquire label. But what does the MM say?



More information about the cpp-threads mailing list