Subj : Re: Optimization to Jeffrey Richter's COptex (Windows)? To : comp.programming.threads From : Joseph Seigh Date : Wed Jan 26 2005 09:40 pm On Thu, 27 Jan 2005 02:41:39 +0100, Alexander Terekhov wrote: > > Joseph Seigh wrote: > [...] >> I'm assuming GetCurrentThreadId or an equivalent intrinsic is very >> efficient. With an unconditional increment of the lockcount you >> end up with the threadid final check after a memory barrier anyway >> so paranoids like Alexander should be happy. :) > > Paranoids like me know that according to the MS docu, > InterlockedCompareExchange() performs nothing ("no operation") if > the Destination value is NOT equal to the Comperand value. > > I can imagine reasonable implementation for XBOX Next that would > have neither trailing "isync" (for acquire msync) nor leading > "sync" (for release msync) instructions on that path. > What matters is if enough of the writers of the applications that get ported to the XBOX were as paranoid as you are. If so, MS can leave the memory barriers out. If not, then having memory barriers will be a de facto requirement. -- Joe Seigh .