Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : Uenal Mutlu Date : Sat May 21 2005 08:31 pm "David Schwartz" wrote > > "Uenal Mutlu" wrote in message > > >> Show me in code how you wait for a condition variable without > >> unsharing > >> it. By "unsharing it", I mean making it no longer shared in the CPU's > >> cache. > > > I've shown that already, see prev. posting. > > There is nothing special to do by the user about it. It is sufficient > > just to use the InterLockedXXX funcs to set and get the atomic variable. > > Requirements for a variable to be used by InterlockedXXX (on x86, MSVC > > compiler), > > is that it must be volatile and right aligned, and of size of the natural > > word size > > of the CPU: here 32 bit integer on 32 bit CPUs: > > > > // a right aligned 32 bit integer on x86 (MSVC code): > > #pragma pack(push, 4) > > volatile long lVar; > > #pragma pack(pop) > > > > Of course such things are best packed (hidden) inside a handy class in > > C++. > > You still haven't answered my question. Show me the code that allows you > to test the value of a shared atomic type without unsharing it. Show you your code first, so to see what exactly you mean. .