--- jsr166/src/test/tck/PhaserTest.java 2017/05/13 23:05:02 1.46 +++ jsr166/src/test/tck/PhaserTest.java 2019/08/11 22:29:27 1.48 @@ -476,24 +476,29 @@ public class PhaserTest extends JSR166Te Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() throws TimeoutException { + long startTime = System.nanoTime(); + Thread.currentThread().interrupt(); try { - phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS); + phaser.awaitAdvanceInterruptibly(0, randomTimeout(), randomTimeUnit()); shouldThrow(); } catch (InterruptedException success) {} assertFalse(Thread.interrupted()); pleaseInterrupt.countDown(); try { - phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS); + phaser.awaitAdvanceInterruptibly(0, LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} assertFalse(Thread.interrupted()); + + assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); }}); await(pleaseInterrupt); assertState(phaser, 0, 1, 1); - assertThreadsStayAlive(t1, t2); + assertThreadBlocks(t1, Thread.State.WAITING); + assertThreadBlocks(t2, Thread.State.TIMED_WAITING); t1.interrupt(); t2.interrupt(); awaitTermination(t1);