Beispiel #1
0
        public void LockTest_CommonPipLockMutallyExclusive()
        {
            Setup();
            var lockManager = new LockManager();

            // Single pip contention
            TestMutuallyExclusive(() => lockManager.AcquireLock(new PipId(20)), () => lockManager.AcquireLock(new PipId(20)));

            // Single pip contention with one pair pip lock
            TestMutuallyExclusive(() => lockManager.AcquireLocks(new PipId(20), new PipId(21)), () => lockManager.AcquireLock(new PipId(20)));

            // Pair pip contention reverse order
            TestMutuallyExclusive(() => lockManager.AcquireLocks(new PipId(20), new PipId(21)), () => lockManager.AcquireLocks(new PipId(21), new PipId(20)));
        }