public void TestGetStateWithReleaseShared() { BooleanLatch l = new BooleanLatch(); Assert.IsFalse(l.IsSignalled()); l.ReleaseShared(0); Assert.IsTrue(l.IsSignalled()); }
private void TestAcquireSharedTimedTimeoutRannable(Object state) { BooleanLatch l = state as BooleanLatch; try { ThreadAssertFalse(l.IsSignalled()); ThreadAssertFalse(l.TryAcquireShared(0, SMALL_DELAY_MS)); } catch (Exception e) { ThreadUnexpectedException(e); } }
private void TestAcquireSharedInterruptiblyRannable(Object state) { BooleanLatch l = state as BooleanLatch; try { ThreadAssertFalse(l.IsSignalled()); l.AcquireSharedInterruptibly(0); ThreadAssertTrue(l.IsSignalled()); } catch (Exception e) { ThreadUnexpectedException(e); } }
public void TestAcquireSharedTimedTimeout() { BooleanLatch l = new BooleanLatch(); Thread t = new Thread(TestAcquireSharedTimedTimeoutRannable); t.Start(l); try { Thread.Sleep(SHORT_DELAY_MS); Assert.IsFalse(l.IsSignalled()); t.Join(); } catch (ThreadInterruptedException e) { UnexpectedException(e); } }
public void TestAcquireSharedInterruptiblyInterruptedException() { BooleanLatch l = new BooleanLatch(); Thread t = new Thread(TestAcquireSharedInterruptiblyInterruptedExceptionRannable); t.Start(l); try { Assert.IsFalse(l.IsSignalled()); t.Interrupt(); t.Join(); } catch (ThreadInterruptedException) { UnexpectedException(); } }
public void TestReleaseShared() { BooleanLatch l = new BooleanLatch(); Assert.IsFalse(l.IsSignalled()); l.ReleaseShared(0); Assert.IsTrue(l.IsSignalled()); l.ReleaseShared(0); Assert.IsTrue(l.IsSignalled()); }