Subj : Re: Optimization to Jeffrey Richter's COptex (Windows)? To : comp.programming.threads From : Joseph Seigh Date : Wed Jan 26 2005 03:03 pm On Wed, 26 Jan 2005 20:03:37 +0100, Alexander Terekhov wrote: > > Joseph Seigh wrote: > [...] >> I'd like to see how you propose that the creation code manages >> to see that 666 has been freed up for reuse and still sees 666 >> in memory as the lock owner. > > Same thing as with condvar queues. > > http://www.google.de/groups?selm=3C615A7E.C61764C7%40web.de > Any i/o or direct processor signaling also. But that's extremely contrived. It would be a great deal of work to create an mechanism that didn't use shared memory simply for the purpose of trying to break programs using thread ids that way. Plus, can you imagine what would happen to your career at Microsoft if you tried to trip up Richter that way? :) I think it's more efficient to put the fetch of the thread id ahead of any interlocked instructions on an ia32 processor. You could make it a speculative fetch and recheck it once you've incremented the count if you cared. -- Joe Seigh .