Subj : Optimization to Jeffrey Richter's COptex (Windows)? To : comp.programming.threads From : Luke Elliott Date : Wed Jan 26 2005 05:41 am Hi I assume most people are familiar with Richter's COptex but if not here's some links: http://www.microsoft.com/msj/0198/win320198.aspx http://www.microsoft.com/msj/0198/win32textfigs.htm#fig2 I've been trying to work out why he's used InterlockedExchange() when setting the owning thread id. As far as I call tell it isn't required with a uni-processor. (I haven't fully convinced myself the interlocked is required on SMP but I think it probably is.) I've tried removing the interlocked exchange of thread id (replaced with normal assignment) and unsurprisingly get a considerable performance boost. This was on a uni-processor machine running a stress testing app. Anybody have any views? I'll happily explain a bit more why I think it isn't necessary on UP but I guess I'm hoping for similar convincing views so I don't have to try and put it into words... Thanks Luke Elliott. .