1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
* Other contributors include Andrew Wright, Jeffrey Hayes, |
6 |
|
* Pat Fisher, Mike Judd. |
7 |
|
*/ |
60 |
|
finally { lock.unlock() ; } |
61 |
|
} |
62 |
|
public void run() { |
63 |
– |
boolean runme; |
63 |
|
lock.lock(); |
64 |
|
try { |
65 |
< |
runme = !done; |
66 |
< |
if (!runme) |
67 |
< |
thread = Thread.currentThread(); |
65 |
> |
if (done) |
66 |
> |
return; |
67 |
> |
thread = Thread.currentThread(); |
68 |
|
} |
69 |
|
finally { lock.unlock() ; } |
71 |
– |
if (!runme) return; |
70 |
|
V v = null; |
71 |
|
Exception e = null; |
72 |
|
try { |
510 |
|
assertFalse(p.isTerminating()); |
511 |
|
p.execute(new CheckedRunnable() { |
512 |
|
public void realRun() throws InterruptedException { |
515 |
– |
threadStarted.countDown(); |
513 |
|
assertFalse(p.isTerminating()); |
514 |
+ |
threadStarted.countDown(); |
515 |
|
done.await(); |
516 |
|
}}); |
517 |
|
assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); |
539 |
|
assertFalse(p.isTerminating()); |
540 |
|
p.execute(new CheckedRunnable() { |
541 |
|
public void realRun() throws InterruptedException { |
544 |
– |
threadStarted.countDown(); |
542 |
|
assertFalse(p.isTerminating()); |
543 |
+ |
threadStarted.countDown(); |
544 |
|
done.await(); |
545 |
|
}}); |
546 |
|
assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); |