Rick Parrish wrote:
Alex Ionescu wrote:
Rick Parrish wrote:
Try this ... add a call to Sleep(0) just before attempting to acquire the lock. That *may* produce better average performance.
You should never use Sleep(0), that's a horrible suggestion.
Use Sleep(1) and/or, SwitchToThread(), and/or YieldProcessor() and /or __mm_pause ("pause").
Thanks Alex. I'll have to check these out.
Oh, and Timo's suggestion is very retro (but very valid) if you remember VAX-11 architecture.
http://h71000.www7.hp.com/DOC/73final/4515/4515pro_023.html
(wandering off topic)
-rick
Yes, it's old school,,, sleep 0 just allows another process (thread) to run and put the one you are running back on top of the "ready to run list". With M$ coding it's all different now. Thanks, James