197 |
|
int s; |
198 |
|
while ((s = status) >= 0) { |
199 |
|
if (UNSAFE.compareAndSwapInt(this, statusOffset, s, completion)) { |
200 |
< |
if (s == SIGNAL) |
200 |
> |
if (s != 0) |
201 |
|
synchronized (this) { notifyAll(); } |
202 |
|
return completion; |
203 |
|
} |
280 |
|
*/ |
281 |
|
private int doJoin() { |
282 |
|
int stat; |
283 |
< |
if ((stat = status) < 0) |
284 |
< |
return stat; |
285 |
< |
Thread t = Thread.currentThread(); |
283 |
> |
Thread t; |
284 |
|
ForkJoinWorkerThread w; |
285 |
< |
if (t instanceof ForkJoinWorkerThread) { |
285 |
> |
if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) { |
286 |
> |
if ((stat = status) < 0) |
287 |
> |
return stat; |
288 |
|
if ((w = (ForkJoinWorkerThread) t).unpushTask(this)) { |
289 |
|
boolean completed; |
290 |
|
try { |
536 |
|
} |
537 |
|
|
538 |
|
/** |
539 |
< |
* Cancels, ignoring any exceptions it throws. Used during worker |
540 |
< |
* and pool shutdown. |
539 |
> |
* Cancels, ignoring any exceptions thrown by cancel. Used during |
540 |
> |
* worker and pool shutdown. Cancel is spec'ed not to throw any |
541 |
> |
* exceptions, but if it does anyway, we have no recourse during |
542 |
> |
* shutdown, so guard against this case. |
543 |
|
*/ |
544 |
|
final void cancelIgnoringExceptions() { |
545 |
|
try { |
673 |
|
else |
674 |
|
pool = null; |
675 |
|
/* |
676 |
< |
* Timed wait loop intermixes cases for fj (pool != null) and |
676 |
> |
* Timed wait loop intermixes cases for FJ (pool != null) and |
677 |
|
* non FJ threads. For FJ, decrement pool count but don't try |
678 |
|
* for replacement; increment count on completion. For non-FJ, |
679 |
|
* deal with interrupts. This is messy, but a little less so |
689 |
|
int s = status; |
690 |
|
if (s < 0) |
691 |
|
break; |
692 |
< |
if (UNSAFE.compareAndSwapInt(this, statusOffset, |
691 |
< |
s, s | SIGNAL)) { |
692 |
> |
if (UNSAFE.compareAndSwapInt(this, statusOffset, s, SIGNAL)) { |
693 |
|
long startTime = System.nanoTime(); |
694 |
|
long nanos = unit.toNanos(timeout); |
695 |
|
long nt; // wait time |