Ejemplo n.º 1
0
        public ILockHolder Upgrade(bool waitForLock)
        {
            if (locker.IsWriteLockHeld)
            {
                return(NoOpLock.Lock);
            }

            writerLock = new SlimWriteLockHolder(locker, waitForLock);
            return(writerLock);
        }
        public ILockHolder Upgrade(bool waitForLock)
        {
            if(locker.IsWriteLockHeld)
            {
                return NoOpLock.Lock;
            }

            writerLock = new SlimWriteLockHolder(locker, waitForLock);
            return writerLock;
        }
 public void Dispose()
 {
     if (writerLock != null && writerLock.LockAcquired)
     {
         writerLock.Dispose();
         writerLock = null;
     }
     if (!LockAcquired) return;
     if (!wasLockAlreadyHeld)
     {
         locker.ExitUpgradeableReadLock();
     }
     lockAcquired = false;
     
 }
Ejemplo n.º 4
0
 public void Dispose()
 {
     if (writerLock != null && writerLock.LockAcquired)
     {
         writerLock.Dispose();
         writerLock = null;
     }
     if (!LockAcquired)
     {
         return;
     }
     if (!wasLockAlreadyHeld)
     {
         locker.ExitUpgradeableReadLock();
     }
     lockAcquired = false;
 }