public void Exit(bool useMemoryBarrier)
{
RuntimeHelpers.PrepareConstrainedRegions();
try { }
finally
{
if (isThreadOwnerTrackingEnabled && !IsHeldByCurrentThread)
{
throw new SynchronizationLockException("Current thread is not the owner of this lock");
}
threadWhoTookLock = int.MinValue;
do
{
if (useMemoryBarrier)
{
ClientInterlocked.Increment(ref ticket.Value);
}
else
{
ticket.Value++;
}
} while (stallTickets != null && ((ClientConcurrentOrderedList <int>)stallTickets).TryRemove(ticket.Value));
}
}