public void TestAcquireInterruptibly2()
        {
            Mutex sync = new Mutex();
            try
            {
                sync.AcquireInterruptibly(1);
            }
            catch(Exception e)
            {
                UnexpectedException(e);
            }

            Thread t = new Thread(InterruptedSyncRunnable);
            try
            {
                t.Start(sync);
                t.Interrupt();
                Assert.IsTrue(sync.AccessIsHeldExclusively());
                t.Join();
            }
            catch(Exception e)
            {
                UnexpectedException(e);
            }
        }
 public void TestTryAcquire()
 {
     Mutex rl = new Mutex();
     Assert.IsTrue(rl.AccessTryAcquire(1));
     Assert.IsTrue(rl.AccessIsHeldExclusively());
     rl.Release(1);
 }
        public void TestGetState()
        {
            Mutex sync = new Mutex();
            sync.Acquire(1);
            Assert.IsTrue(sync.AccessIsHeldExclusively());
            sync.Release(1);
            Assert.IsFalse(sync.AccessIsHeldExclusively());
            Thread t = new Thread(TestGetStateRunnable);

            try
            {
                t.Start(sync);
                Thread.Sleep(SHORT_DELAY_MS);
                Assert.IsTrue(sync.AccessIsHeldExclusively());
                t.Join();
                Assert.IsFalse(sync.AccessIsHeldExclusively());
            }
            catch(Exception e)
            {
                UnexpectedException(e);
            }
        }
 public void TestIsHeldExclusively()
 {
     Mutex rl = new Mutex();
     Assert.IsFalse(rl.AccessIsHeldExclusively());
 }