예제 #1
0
        public ILockHolder Upgrade(bool waitForLock)
        {
            if (locker.IsWriteLockHeld)
            {
                return(NoOpLock.Lock);
            }

            writerLock = new SlimWriteLockHolder(locker, waitForLock);
            return(writerLock);
        }
예제 #2
0
 public void Dispose()
 {
     if (writerLock != null && writerLock.LockAcquired)
     {
         writerLock.Dispose();
         writerLock = null;
     }
     if (!LockAcquired)
     {
         return;
     }
     if (!wasLockAlreadyHeld)
     {
         locker.ExitUpgradeableReadLock();
     }
     lockAcquired = false;
 }