Beispiel #1
0
        public void ReacquireLocks(LockState lockState)
        {
            int writeLockCounter = lockState.writeLockCount;
            int readLockCounter  = lockState.readLockCount;

            while (writeLockCounter-- > 0)
            {
                WriteLock.Lock();
            }
            while (readLockCounter-- > 0)
            {
                ReadLock.Lock();
            }
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public void ReacquireLocks(LockState lockState)
 {
     rwLock.ReacquireLocks(lockState);
 }