public void thread3() { waitForTick(2); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertEquals(2, sync.getWaitQueueLength(c)); c.signalAll(); sync.release(1); waitForTick(3); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); sync.release(1); }
public void thread3() { sync.acquire(1); assertTrue(sync.getWaitingThreads(c).isEmpty()); sync.release(1); waitForTick(3); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertTrue(sync.getWaitingThreads(c).contains(getThread(1))); assertTrue(sync.getWaitingThreads(c).contains(getThread(2))); c.signalAll(); sync.release(1); waitForTick(4); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertTrue(sync.getWaitingThreads(c).isEmpty()); sync.release(1); }
public void thread3() { waitForTick(1); sync.acquire(1); c.signalAll(); sync.release(1); }