On Wed, 28 Jun 2023 11:05:11 GMT, Sergey Tsypanov <stsypa...@openjdk.org> wrote:

> Double-checked locking should rely on local variable to avoid racy reads from 
> volatile field.

The new code makes it more visible that 1. keySet is expected to be volatile 
and 2. that there is no path were code could be reordered leading to the 
'wrong' value of keySet being returned. So maybe there's no race, but the new 
code make it more obvious.

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

PR Comment: https://git.openjdk.org/jdk/pull/14692#issuecomment-1613165837

Reply via email to