2 |
|
* Written by Doug Lea and Martin Buchholz with assistance from |
3 |
|
* members of JCP JSR-166 Expert Group and released to the public |
4 |
|
* domain, as explained at |
5 |
< |
* http://creativecommons.org/licenses/publicdomain |
5 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
6 |
|
* Other contributors include Andrew Wright, Jeffrey Hayes, |
7 |
|
* Pat Fisher, Mike Judd. |
8 |
|
*/ |
34 |
|
}}); |
35 |
|
|
36 |
|
threadStarted.await(); |
37 |
< |
Thread.sleep(SHORT_DELAY_MS); |
37 |
> |
delay(SHORT_DELAY_MS); |
38 |
|
LockSupport.unpark(t); |
39 |
|
awaitTermination(t, MEDIUM_DELAY_MS); |
40 |
|
} |
55 |
|
}}); |
56 |
|
|
57 |
|
threadStarted.await(); |
58 |
< |
Thread.sleep(SHORT_DELAY_MS); |
58 |
> |
delay(SHORT_DELAY_MS); |
59 |
|
LockSupport.unpark(t); |
60 |
|
awaitTermination(t, MEDIUM_DELAY_MS); |
61 |
|
} |
75 |
|
}}); |
76 |
|
|
77 |
|
threadStarted.await(); |
78 |
< |
Thread.sleep(SHORT_DELAY_MS); |
78 |
> |
delay(SHORT_DELAY_MS); |
79 |
|
LockSupport.unpark(t); |
80 |
|
awaitTermination(t, MEDIUM_DELAY_MS); |
81 |
|
} |
163 |
|
}}); |
164 |
|
|
165 |
|
threadStarted.await(); |
166 |
< |
Thread.sleep(SHORT_DELAY_MS); |
166 |
> |
delay(SHORT_DELAY_MS); |
167 |
|
t.interrupt(); |
168 |
|
awaitTermination(t, MEDIUM_DELAY_MS); |
169 |
|
} |
188 |
|
}}); |
189 |
|
|
190 |
|
threadStarted.await(); |
191 |
< |
Thread.sleep(SHORT_DELAY_MS); |
191 |
> |
delay(SHORT_DELAY_MS); |
192 |
|
t.interrupt(); |
193 |
|
awaitTermination(t, MEDIUM_DELAY_MS); |
194 |
|
} |
212 |
|
}}); |
213 |
|
|
214 |
|
threadStarted.await(); |
215 |
< |
Thread.sleep(SHORT_DELAY_MS); |
215 |
> |
delay(SHORT_DELAY_MS); |
216 |
|
t.interrupt(); |
217 |
|
awaitTermination(t, MEDIUM_DELAY_MS); |
218 |
|
} |
309 |
|
awaitTermination(t, MEDIUM_DELAY_MS); |
310 |
|
} |
311 |
|
|
312 |
– |
|
312 |
|
/** |
313 |
|
* parkUntil times out if not unparked |
314 |
|
*/ |
331 |
|
} |
332 |
|
|
333 |
|
/** |
334 |
< |
* parkUntil(0) returns immediately |
334 |
> |
* getBlocker(null) throws NullPointerException |
335 |
> |
*/ |
336 |
> |
public void testGetBlockerNull() { |
337 |
> |
try { |
338 |
> |
LockSupport.getBlocker(null); |
339 |
> |
shouldThrow(); |
340 |
> |
} catch (NullPointerException success) {} |
341 |
> |
} |
342 |
> |
|
343 |
> |
/** |
344 |
> |
* parkUntil(0) returns immediately. |
345 |
> |
* |
346 |
|
* Requires hotspot fix for: |
347 |
|
* 6763959 java.util.concurrent.locks.LockSupport.parkUntil(0) blocks forever |
348 |
+ |
* which is in jdk7-b118 and 6u25. |
349 |
|
*/ |
350 |
< |
public void XXXXtestParkUntil0Returns() throws InterruptedException { |
350 |
> |
public void testParkUntil0Returns() throws InterruptedException { |
351 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
352 |
|
public void realRun() { |
353 |
|
LockSupport.parkUntil(0L); |
354 |
|
}}); |
355 |
|
|
356 |
< |
awaitTermination(t, MEDIUM_DELAY_MS); |
356 |
> |
awaitTermination(t); |
357 |
|
} |
358 |
|
} |