On Thu, 5 Sep 2024 15:50:42 GMT, Viktor Klang <vkl...@openjdk.org> wrote:

>> Well, I am not so sure, I've sent you pointers separately regarding lazy 
>> initialization and the relevant concurrency pointers.
>
> I'd recommend documenting above this line what function the lock is intending 
> to serve, and by each of the members that it guards accesses to. Something 
> like "//guarded by 'lock'".
> 
> Also, ook into whether the members guarded by the lock needs `volatile`: 
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

My understanding is that `volatile` is used when accessing the contents of the 
object, which we are not doing with this locking object, so IMO there is no 
reason for the keyword to be added.

I'll apply your other suggestion about explicit comments.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1745944991

Reply via email to