223 |
|
} |
224 |
|
public void testParkAfterInterrupt(final ParkMethod parkMethod) { |
225 |
|
final CountDownLatch pleaseInterrupt = new CountDownLatch(1); |
226 |
– |
final AtomicBoolean pleasePark = new AtomicBoolean(false); |
226 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
227 |
|
public void realRun() throws Exception { |
228 |
|
pleaseInterrupt.countDown(); |
229 |
< |
while (!pleasePark.get()) |
229 |
> |
while (!Thread.currentThread().isInterrupted()) |
230 |
|
Thread.yield(); |
232 |
– |
assertTrue(Thread.currentThread().isInterrupted()); |
231 |
|
parkMethod.park(); |
232 |
< |
assertTrue(Thread.currentThread().isInterrupted()); |
232 |
> |
assertTrue(Thread.interrupted()); |
233 |
|
}}); |
234 |
|
|
235 |
|
await(pleaseInterrupt); |
236 |
|
t.interrupt(); |
239 |
– |
pleasePark.set(true); |
237 |
|
awaitTermination(t); |
238 |
|
} |
239 |
|
|