public void TestGetWaitingThreadsIMSE()
 {
     PublicReentrantReadWriteLock locker = new PublicReentrantReadWriteLock();
     Condition c = (locker.WriteLock.NewCondition());
     try
     {
         locker.AccessGetWaitingThreads(c);
         ShouldThrow();
     }
     catch (ThreadStateException)
     {
     }
     catch (Exception e)
     {
         UnexpectedException(e);
     }
 }
     public void TestGetWaitingThreads()
     {
         PublicReentrantReadWriteLock locker = new PublicReentrantReadWriteLock();
         Condition c = locker.WriteLock.NewCondition();
         Pair data = new Pair(locker, c);
         Thread t1 = new Thread(TestGetWaitingThreadsRun1);
         Thread t2 = new Thread(TestGetWaitingThreadsRun2);
 
         try
         {
             locker.WriteLock.Lock();
             Assert.IsTrue(locker.AccessGetWaitingThreads(c).IsEmpty());
             locker.WriteLock.UnLock();
             t1.Start(data);
             Thread.Sleep(SHORT_DELAY_MS);
             t2.Start(data);
             Thread.Sleep(SHORT_DELAY_MS);
             locker.WriteLock.Lock();
             Assert.IsTrue(locker.HasWaiters(c));
             Assert.IsTrue(locker.AccessGetWaitingThreads(c).Contains(t1));
             Assert.IsTrue(locker.AccessGetWaitingThreads(c).Contains(t2));
             c.SignalAll();
             locker.WriteLock.UnLock();
             Thread.Sleep(SHORT_DELAY_MS);
             locker.WriteLock.Lock();
             Assert.IsFalse(locker.HasWaiters(c));
             Assert.IsTrue(locker.AccessGetWaitingThreads(c).IsEmpty());
             locker.WriteLock.UnLock();
             t1.Join(SHORT_DELAY_MS);
             t2.Join(SHORT_DELAY_MS);
             Assert.IsFalse(t1.IsAlive);
             Assert.IsFalse(t2.IsAlive);
         }
         catch (Exception e)
         {
             UnexpectedException(e);
         }
     }
 public void TestGetWaitingThreadsNRE()
 {
     PublicReentrantReadWriteLock locker = new PublicReentrantReadWriteLock();
     try
     {
         locker.AccessGetWaitingThreads(null);
         ShouldThrow();
     }
     catch (NullReferenceException)
     {
     }
     catch (Exception e)
     {
         UnexpectedException(e);
     }
 }