From ce51e883d8f8d3168452e17e416fb87f81217516 Mon Sep 17 00:00:00 2001 From: Koundinya Veluri Date: Fri, 25 Aug 2017 12:21:14 -0700 Subject: [PATCH] Add new member to RuntimeThread for shared changes in CoreCLR PR https://github.com/dotnet/coreclr/pull/13670 adds a new member to RuntimeThread is that used by SpinWait. SpinWait is shared, so this PR is adding the new member to CoreRT first to avoid a break. --- .../src/Internal/Runtime/Augments/RuntimeThread.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs index 0589784047b..b21d9ced8bd 100644 --- a/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs +++ b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs @@ -371,6 +371,15 @@ public bool Join(int millisecondsTimeout) } public static void Sleep(int millisecondsTimeout) => SleepInternal(VerifyTimeoutMilliseconds(millisecondsTimeout)); + + /// + /// Max value to be passed into for optimal delaying. Currently, the value comes from + /// defaults in CoreCLR's Thread::InitializeYieldProcessorNormalized(). This value is supposed to be normalized to be + /// appropriate for the processor. + /// TODO: See issue https://github.com/dotnet/corert/issues/4430 + /// + internal static readonly int OptimalMaxSpinWaitsPerSpinIteration = 64; + public static void SpinWait(int iterations) => RuntimeImports.RhSpinWait(iterations); public static bool Yield() => RuntimeImports.RhYield();