Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,15 @@ public bool Join(int millisecondsTimeout)
}

public static void Sleep(int millisecondsTimeout) => SleepInternal(VerifyTimeoutMilliseconds(millisecondsTimeout));

/// <summary>
/// Max value to be passed into <see cref="SpinWait(int)"/> 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
/// </summary>
internal static readonly int OptimalMaxSpinWaitsPerSpinIteration = 64;

public static void SpinWait(int iterations) => RuntimeImports.RhSpinWait(iterations);
public static bool Yield() => RuntimeImports.RhYield();

Expand Down