网上演练
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
717 B

// Needed for NET40
#if !NET_4_6
using System;
using System.Threading;
namespace LinqInternal.Threading
{
[System.Diagnostics.DebuggerNonUserCode]
internal static partial class ThreadingHelper
{
internal const int _sleepCountHint = 10;
private const int _maxTime = 200;
public static void MemoryBarrier()
{
#if NETCOREAPP1_1
Interlocked.MemoryBarrier();
#else
Thread.MemoryBarrier();
#endif
}
internal static long Milliseconds(long ticks)
{
return ticks / TimeSpan.TicksPerMillisecond;
}
internal static long TicksNow()
{
return DateTime.Now.Ticks;
}
}
}
#endif