On Wed, 21 Jan 2026 16:35:41 GMT, Doug Lea <[email protected]> wrote:

>> Changes signal filtering to avoid possible starvation
>
> Doug Lea has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Try out different approach

src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1460:

> 1458:                 ++taken;
> 1459:             }
> 1460:             return taken;

Since `q` can never be null, and `task` initially is never null, perhaps we 
could do:


        final int topLevelExec(ForkJoinTask<?> task, WorkQueue q, ForkJoinPool 
pool,
                               int fifo) {
            int taken = 0;
            if (task != null && q != null) {
                ForkJoinPool p = (fifo == 0) ? null : pool;
                do {
                    task.doExec();
                    ++taken;
                } while ((task = nextLocalTask(fifo)) != null || (task = 
q.tryPoll(p)) != null));
            }
            return taken;
        }

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28797#discussion_r2717771468

Reply via email to