public void ReacquireLocks(LockState lockState) { int writeLockCounter = lockState.writeLockCount; int readLockCounter = lockState.readLockCount; while (writeLockCounter-- > 0) { WriteLock.Lock(); } while (readLockCounter-- > 0) { ReadLock.Lock(); } }
public LockState ReleaseAllLocks() { int readLockCounter = 0; while (rwlSlim.IsReadLockHeld) { rwlSlim.ExitReadLock(); readLockCounter++; } int writeLockCounter = 0; while (rwlSlim.IsWriteLockHeld) { rwlSlim.ExitWriteLock(); writeLockCounter++; } LockState lockState = new LockState(); lockState.readLockCount = readLockCounter; lockState.writeLockCount = writeLockCounter; return(lockState); }
public void ReacquireLocks(LockState lockState) { rwLock.ReacquireLocks(lockState); }