189 |
|
do { |
190 |
|
parkMethod.park(); |
191 |
|
// park may return spuriously |
192 |
< |
} while (! Thread.currentThread().isInterrupted()); |
192 |
> |
} while (! Thread.interrupted()); |
193 |
|
}}); |
194 |
|
|
195 |
|
await(pleaseInterrupt); |
256 |
|
public void testParkTimesOut(final ParkMethod parkMethod) { |
257 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
258 |
|
public void realRun() { |
259 |
< |
for (;;) { |
259 |
> |
for (int tries = MAX_SPURIOUS_WAKEUPS; tries-->0; ) { |
260 |
|
long startTime = System.nanoTime(); |
261 |
|
parkMethod.park(timeoutMillis()); |
262 |
|
// park may return spuriously |
263 |
|
if (millisElapsedSince(startTime) >= timeoutMillis()) |
264 |
|
return; |
265 |
|
} |
266 |
+ |
fail("too many consecutive spurious wakeups?"); |
267 |
|
}}); |
268 |
|
|
269 |
|
awaitTermination(t); |
302 |
|
parkMethod.park(); |
303 |
|
assertNull(LockSupport.getBlocker(t)); |
304 |
|
// park may return spuriously |
305 |
< |
} while (! Thread.currentThread().isInterrupted()); |
305 |
> |
} while (! Thread.interrupted()); |
306 |
|
}}); |
307 |
|
|
308 |
|
long startTime = System.nanoTime(); |