330 |
|
public void testAwaitAdvance3() throws InterruptedException { |
331 |
|
final Phaser phaser = new Phaser(); |
332 |
|
phaser.register(); |
333 |
+ |
final CountDownLatch threadStarted = new CountDownLatch(1); |
334 |
|
|
335 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
336 |
|
public void realRun() throws InterruptedException { |
337 |
|
phaser.register(); |
338 |
< |
sleepTillInterrupted(LONG_DELAY_MS); |
338 |
> |
threadStarted.countDown(); |
339 |
|
phaser.awaitAdvance(phaser.arrive()); |
340 |
+ |
assertTrue(Thread.currentThread().isInterrupted()); |
341 |
|
}}); |
342 |
< |
Thread.sleep(SMALL_DELAY_MS); |
342 |
> |
assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); |
343 |
|
t.interrupt(); |
342 |
– |
Thread.sleep(SMALL_DELAY_MS); |
344 |
|
phaser.arrive(); |
345 |
< |
assertFalse(t.isInterrupted()); |
345 |
< |
t.join(); |
345 |
> |
awaitTermination(t, SMALL_DELAY_MS); |
346 |
|
} |
347 |
|
|
348 |
|
/** |