Reduce reliance on noUserHelp

This commit is contained in:
Doug Lea 2026-03-11 08:54:49 -04:00
parent caeb66bbff
commit 1ba9fc6efd
2 changed files with 482 additions and 423 deletions

View File

@ -641,10 +641,15 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
*/
public final ForkJoinTask<V> fork() {
Thread t; ForkJoinWorkerThread wt;
if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
((wt = (ForkJoinWorkerThread)t).workQueue).push(this, wt.pool, 1);
ForkJoinPool p; ForkJoinPool.WorkQueue q; boolean internal;
if (internal =
(t = Thread.currentThread()) instanceof ForkJoinWorkerThread) {
q = (wt = (ForkJoinWorkerThread)t).workQueue;
p = wt.pool;
}
else
ForkJoinPool.common.externalPush(this, true, false);
q = (p = ForkJoinPool.common).externalSubmissionQueue(false);
q.push(this, p, internal);
return this;
}