On Fri, 31 May 2024 14:04:50 GMT, Viktor Klang <vkl...@openjdk.org> wrote:

>> Doug Lea has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Reconcile changes
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2024:
> 
>> 2022:                                 }
>> 2023:                                 if (pb == (pb = b))       // base 
>> unchanged
>> 2024:                                     Thread.onSpinWait();
> 
> @DougLea Doesn't this mean that we'll always onSpinWait at least once here 
> (since pb is initialized to -1 and not written until this check)

No, almost the opposite: it only spinWaits if base is apparently stuck, except 
(harmlessly) every 4B encounters when it happens to be -1. (The value -1 works 
best here since base starts at 0 and is simpler than other ways of checking for 
stalls.)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1622505491

Reply via email to