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; }