Given the following code:
...
private static SpinLock logLock = new SpinLock(false);
...
private static void ThreadFunc()
{
bool lockTaken = false;
logLock.Enter(ref lockTaken)
{
try
{
// do stuff with during an acquired SpinLock
}
finally
{
logLock.Exit();
}
}
}
If the Enter block "fails" because it receives a false on the lock being acquired, does the current thread spin like a spinlock and wait until it can acquire it or is this block simply bypassed and that thread loses out ?
Thanks,
Scott