public void TestHasQueuedThread()
        {
            ReentrantReadWriteLock sync = new ReentrantReadWriteLock();
            Thread t1 = new Thread(InterruptedLockRunnable);
            Thread t2 = new Thread(InterruptibleLockRunnable);

            try
            {
                Assert.IsFalse(sync.HasQueuedThread(t1));
                Assert.IsFalse(sync.HasQueuedThread(t2));
                sync.WriteLock.Lock();
                t1.Start(sync);
                Thread.Sleep(SHORT_DELAY_MS);
                Assert.IsTrue(sync.HasQueuedThread(t1));
                t2.Start(sync);
                Thread.Sleep(SHORT_DELAY_MS);
                Assert.IsTrue(sync.HasQueuedThread(t1));
                Assert.IsTrue(sync.HasQueuedThread(t2));
                t1.Interrupt();
                Thread.Sleep(SHORT_DELAY_MS);
                Assert.IsFalse(sync.HasQueuedThread(t1));
                Assert.IsTrue(sync.HasQueuedThread(t2));
                sync.WriteLock.UnLock();
                Thread.Sleep(SHORT_DELAY_MS);
                Assert.IsFalse(sync.HasQueuedThread(t1));
                Thread.Sleep(SHORT_DELAY_MS);
                Assert.IsFalse(sync.HasQueuedThread(t2));
                t1.Join();
                t2.Join();
            }
            catch(Exception e)
            {
                UnexpectedException(e);
            }
        }
 public void TestHasQueuedThreadNRE()
 {
     ReentrantReadWriteLock sync = new ReentrantReadWriteLock();
     try
     {
         sync.HasQueuedThread(null);
         ShouldThrow();
     }
     catch (NullReferenceException)
     {
     }
 }