Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InitializeCriticalSectionAndSpinCount, is there a default Spin Count?

The API method InitializeCriticalSectionAndSpinCount allows you to set a spin count so when EnterCriticalSection is called, it loops using a spinlock to try to acquire the resource some number of times. Only if all the attempts fail does the thread transition to kernel mode to enter a wait state.

If the 'normal' InitializeCriticalSection() is called instead, is there a 'default' spin count set? (Or is it 0, no spin?)

like image 950
Darian Miller Avatar asked Dec 17 '10 21:12

Darian Miller


1 Answers

Quoting from this article:

SpinCount ... This field defaults to zero, but can be set to a different value with the InitializeCriticalSectionAndSpinCount API

So the default is no spin.

like image 137
Praetorian Avatar answered Oct 08 '22 01:10

Praetorian