Subj : Re: Memory visibility and MS Interlocked instructions To : comp.programming.threads From : Alexander Terekhov Date : Sat Sep 03 2005 11:14 pm Peter Dimov wrote: [...] > I find that very odd. Not the absence of atomic visibility per se, > but... > > P1: X = 1; #storestore; Y = 1; > P2: if( Y == 1) { #loadstore; Z = 1; } That's dependent store, no barrier needed. > P3: if( Z == 1) { #loadload; assert( X == 1 ); } > > If Z == 1 happens before X == 1, Z = 1 happens-before Z == 1, Y == 1 > happens-before Z = 1, Y = 1 happens-before Y == 1 and X = 1 > happens-before Y = 1, then X = 1 happens-before X == 1, right? Right. Under PC, P1: X = 1; Y = 1; P2: if( Y == 1) { Z = 1; } P3: if( Z == 1) { assert( X == 1 ); } Z == 1 && X != 1 is false. regards, alexander. .