On Mon, 4 Nov 2024 21:57:39 GMT, ExE Boss <d...@openjdk.org> wrote:

>> Doesn't using `setOpaque` mean that another thread may see the update to 
>> `state` before the update to `acquireCount`? i.e. the scope of a memory 
>> segment may appear closed, but the segment would still be passable to a 
>> downcall?
>
> `acquireCount` is always accessed using `volatile` semantics by 
> `SharedSession`.

The close operation is not performance-critical so I think using volatile 
semantics here would have little or no negative performance impact. From a 
maintenance and readability point of view (in my subjective opinion) volatile 
is easier to understand.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21810#discussion_r1828941391

Reply via email to