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

◆ BlockingConfig()

static System.Threading.PortableThreadPool.BlockingConfig.BlockingConfig ( )
inlinestaticprivate

Definition at line 56 of file PortableThreadPool.cs.

57 {
58 IsCooperativeBlockingEnabled = AppContextConfigHelper.GetBooleanConfig("System.Threading.ThreadPool.Blocking.CooperativeBlocking", defaultValue: true);
59 int int32Config = AppContextConfigHelper.GetInt32Config("System.Threading.ThreadPool.Blocking.ThreadsToAddWithoutDelay_ProcCountFactor", 1, allowNegative: false);
60 int int32Config2 = AppContextConfigHelper.GetInt32Config("System.Threading.ThreadPool.Blocking.ThreadsPerDelayStep_ProcCountFactor", 1, allowNegative: false);
61 DelayStepMs = (uint)AppContextConfigHelper.GetInt32Config("System.Threading.ThreadPool.Blocking.DelayStepMs", 25, allowNegative: false);
62 MaxDelayMs = (uint)AppContextConfigHelper.GetInt32Config("System.Threading.ThreadPool.Blocking.MaxDelayMs", 250, allowNegative: false);
63 int processorCount = Environment.ProcessorCount;
64 ThreadsToAddWithoutDelay = (short)(processorCount * int32Config);
65 if (ThreadsToAddWithoutDelay > short.MaxValue || ThreadsToAddWithoutDelay / processorCount != int32Config)
66 {
67 ThreadsToAddWithoutDelay = short.MaxValue;
68 }
69 int32Config2 = Math.Max(1, int32Config2);
70 short num = (short)(32767 - ThreadsToAddWithoutDelay);
71 ThreadsPerDelayStep = (short)(processorCount * int32Config2);
72 if (ThreadsPerDelayStep > num || ThreadsPerDelayStep / processorCount != int32Config2)
73 {
75 }
76 MaxDelayMs = Math.Max(1u, Math.Min(MaxDelayMs, 500u));
77 DelayStepMs = Math.Max(1u, Math.Min(DelayStepMs, MaxDelayMs));
78 }

References System.Threading.PortableThreadPool.BlockingConfig.DelayStepMs, System.AppContextConfigHelper.GetBooleanConfig(), System.AppContextConfigHelper.GetInt32Config(), System.Threading.PortableThreadPool.BlockingConfig.IsCooperativeBlockingEnabled, System.Math.Max(), System.Threading.PortableThreadPool.BlockingConfig.MaxDelayMs, System.Math.Min(), System.Environment.ProcessorCount, System.Threading.PortableThreadPool.BlockingConfig.ThreadsPerDelayStep, and System.Threading.PortableThreadPool.BlockingConfig.ThreadsToAddWithoutDelay.