ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/PhaserTest.java
(Generate patch)

Comparing jsr166/src/test/tck/PhaserTest.java (file contents):
Revision 1.46 by jsr166, Sat May 13 23:05:02 2017 UTC vs.
Revision 1.48 by jsr166, Sun Aug 11 22:29:27 2019 UTC

# Line 476 | Line 476 | public class PhaserTest extends JSR166Te
476  
477          Thread t2 = newStartedThread(new CheckedRunnable() {
478              public void realRun() throws TimeoutException {
479 +                long startTime = System.nanoTime();
480 +
481                  Thread.currentThread().interrupt();
482                  try {
483 <                    phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS);
483 >                    phaser.awaitAdvanceInterruptibly(0, randomTimeout(), randomTimeUnit());
484                      shouldThrow();
485                  } catch (InterruptedException success) {}
486                  assertFalse(Thread.interrupted());
487  
488                  pleaseInterrupt.countDown();
489                  try {
490 <                    phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS);
490 >                    phaser.awaitAdvanceInterruptibly(0, LONG_DELAY_MS, MILLISECONDS);
491                      shouldThrow();
492                  } catch (InterruptedException success) {}
493                  assertFalse(Thread.interrupted());
494 +
495 +                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
496              }});
497  
498          await(pleaseInterrupt);
499          assertState(phaser, 0, 1, 1);
500 <        assertThreadsStayAlive(t1, t2);
500 >        assertThreadBlocks(t1, Thread.State.WAITING);
501 >        assertThreadBlocks(t2, Thread.State.TIMED_WAITING);
502          t1.interrupt();
503          t2.interrupt();
504          awaitTermination(t1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines