예제 #1
0
        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));
            }
        }
예제 #2
0
 public void ExitWriteLock()
 {
     ClientInterlocked.Add(ref rwlock, -RwWrite);
 }
예제 #3
0
 public void ExitReadLock()
 {
     ClientInterlocked.Add(ref rwlock, -RwRead);
 }