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