Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Wait()

static void System.Threading.LowLevelSpinWaiter.Wait ( int spinIndex,
int sleep0Threshold,
int processorCount )
inlinestatic

Definition at line 32 of file LowLevelSpinWaiter.cs.

33 {
34 if (processorCount > 1 && (spinIndex < sleep0Threshold || (spinIndex - sleep0Threshold) % 2 != 0))
35 {
36 int num = Thread.OptimalMaxSpinWaitsPerSpinIteration;
37 if (spinIndex <= 30 && 1 << spinIndex < num)
38 {
39 num = 1 << spinIndex;
40 }
41 Thread.SpinWait(num);
42 }
43 else
44 {
45 Thread.UninterruptibleSleep0();
46 }
47 }

References System.Threading.Thread.OptimalMaxSpinWaitsPerSpinIteration, System.Threading.Thread.SpinWait(), and System.Threading.Thread.UninterruptibleSleep0().

Referenced by System.Threading.LowLevelSpinWaiter.SpinWaitForCondition(), and System.Threading.LowLevelLifoSemaphore.Wait().