[ros-dev] Mayday ... Critical Section problems

Alex Ionescu ionucu at videotron.ca
Wed Nov 1 16:07:35 CET 2006


Rick Parrish wrote:
> Christian Wallukat wrote:
> 
>>I have a problem with CriticalSection / InterlockIncrement / Decrement on
>>WinXP (sorry for bother but maybe it is also important for us):
>>  
> 
> Try this ... add a call to Sleep(0) just before attempting to acquire 
> the lock. That *may* produce better average performance.
> 
> -rick
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
> 

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").

-- 
Best regards,
Alex Ionescu
Project Lead, TinyKRNL
Kernel-Mode Software Design Engineer, ReactOS


More information about the Ros-dev mailing list