Subj : Re: Memory Barriers, Compiler Optimizations, etc. To : comp.programming.threads From : Alexander Terekhov Date : Mon Feb 07 2005 10:05 pm SenderX wrote: [...] > static CMyData my_data; > static volatile LONG flag = 0; atomic flag(false); > > my_data.setup(); > InterlockedCompareExchange( &flag, 1, 0 ); flag.store(true, msync::rel); > > AnotherConcurrentThread > ------------------ > > while ( ! InterlockedCompareExchange( &flag, 0, 0 ) ) { Sleep( 0 ); _asm while (!flag.load(msync::acq)) ... regards, alexander. .