Subj : Re: Memory visibility and MS Interlocked instructions To : comp.programming.threads From : Alexander Terekhov Date : Sun Sep 04 2005 12:20 am Peter Dimov wrote: [...] > > P1: X = 1; Y = 1; > > P2: if( Y == 1) { Z = 1; } > > P3: if( Z == 1) { assert( X == 1 ); } > > > > Z == 1 && X != 1 is false. > > Great. But > > P1: Y = 1; > P2: if( Y == 1 ) { Z = 1; } > P3: if( Z == 1 ) { assert( Y == 1 ); } > > may assert. This still breaks happens-before; there is a similar Y = 1 Y = 1 (and Z = 1) are writes "in progress". > << Y == 1 << Z = 1 << Z == 1 << (other) Y == 1 chain. P1: Y = 1; Y = 2; P2: if( Y == 2 ) { Z = 1; } P3: if( Z == 1 ) { assert( Y >= 1 ); } regards, alexander. .