Subj : Re: Memory Barriers, Compiler Optimizations, etc. To : comp.programming.threads From : SenderX Date : Mon Feb 07 2005 11:41 am > > Here are some questions that need clarification in your documentation: > > > > 1. Can external data depend on the return value from a failed CAS? > > I don't undestand what your asking. static CMyData my_data; static volatile LONG flag = 0; my_data.setup(); InterlockedCompareExchange( &flag, 1, 0 ); AnotherConcurrentThread ------------------ while ( ! InterlockedCompareExchange( &flag, 0, 0 ) ) { Sleep( 0 ); _asm pause; } // flag is set my_data.use(); Is this safe? .