internal void WaitBriefly(ref int attempt)
{
if (attempt == SleepInterval)
{
#if WINDOWS
Thread.Yield();
#else
Thread.Sleep(0);
#endif
//TODO: Thread.Yield on windows?
//Check multithreaded bookmarks performance conscious
//and .netspinlock
attempt -= SleepInterval;
}
else
{
Thread.SpinWait(Math.Min(3 << attempt, MaximumSpinWait));
}
}
}