On Wed, 25 Nov 2026 19:53:15 GMT, Viktor Klang <[email protected]> wrote:

>> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2777:
>> 
>>> 2775:                 WorkQueue w = new WorkQueue(null, id, 0, false);
>>> 2776:                 long stop = lockRunState() & STOP;
>>> 2777:                 if (stop == 0L && (qs = queues) != null && i < 
>>> qs.length &&
>> 
>> @DougLea When we re-read `queues` here and that yields a separate instance 
>> than `qs` was up until then, then `i` is likely wrong as `i` is based on the 
>> previous `qs`:s length, so we should probably retry the loop if `qs != qs = 
>> queues)` (or something like that). Or am I wrong? :)
>
> @DougLea I think we really need to check `qs == (qs = queues)` here since we 
> calculated `i` for what could be another `qs`. It should be enough to do that 
> since we have the lock on runState on this line.

@DougLea I guess it is either that or unconditionally recalculate `i` after 
obtaining the new `queues`.

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

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

Reply via email to