Subj : Re: Memory visibility and MS Interlocked instructions To : comp.programming.threads From : Alexander Terekhov Date : Fri Aug 26 2005 01:04 pm Peter Dimov wrote: [...] > But to be done better, it requires a _very_ smart compiler, right? Nah. Just smart. ;-) > > if( load(&v, ccacq_true) == 0 ) > { > // #1 > } > else > { > // #2 > } > > load r1, v > cmp r1, 0 > bne @2 > > @1: > isync > #1 > b @3 > > @2: > #2 > > @3: Yep. And compiler can hoist loads and stores on #2 and #3 pathes (move'em above if... suppose that control always rich #3). regards, alexander. .