644 |
|
* @throws CancellationException {@inheritDoc} |
645 |
|
*/ |
646 |
|
public final V get() throws InterruptedException, ExecutionException { |
647 |
< |
quietlyJoin(); |
648 |
< |
if (Thread.interrupted()) |
649 |
< |
throw new InterruptedException(); |
650 |
< |
int s = status; |
647 |
> |
int s; |
648 |
> |
if (Thread.currentThread() instanceof ForkJoinWorkerThread) { |
649 |
> |
quietlyJoin(); |
650 |
> |
s = status; |
651 |
> |
} |
652 |
> |
else { |
653 |
> |
while ((s = status) >= 0) { |
654 |
> |
synchronized (this) { // interruptible form of awaitDone |
655 |
> |
if (UNSAFE.compareAndSwapInt(this, statusOffset, |
656 |
> |
s, SIGNAL)) { |
657 |
> |
while (status >= 0) |
658 |
> |
wait(); |
659 |
> |
} |
660 |
> |
} |
661 |
> |
} |
662 |
> |
} |
663 |
|
if (s < NORMAL) { |
664 |
|
Throwable ex; |
665 |
|
if (s == CANCELLED) |