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

James Tabor jimtabor at adsl-64-217-116-74.dsl.hstntx.swbell.net
Wed Nov 1 21:11:34 CET 2006


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


More information about the Ros-dev mailing list