13 if (num <= processorCount)
15 for (
int i = ((processorCount <= 1) ? sleep0Threshold : 0); i < spinCount; i++)
17 Wait(i, sleep0Threshold, processorCount);
32 public static void Wait(
int spinIndex,
int sleep0Threshold,
int processorCount)
34 if (processorCount > 1 && (spinIndex < sleep0Threshold || (spinIndex - sleep0Threshold) % 2 != 0))
37 if (spinIndex <= 30 && 1 << spinIndex < num)
static int ProcessorCount
static int Decrement(ref int location)
static int Increment(ref int location)
static int OptimalMaxSpinWaitsPerSpinIteration
static void SpinWait(int iterations)
static void UninterruptibleSleep0()
bool SpinWaitForCondition(Func< bool > condition, int spinCount, int sleep0Threshold)
static void Wait(int spinIndex, int sleep0Threshold, int processorCount)