On Mon, 4 Nov 2024 19:08:49 GMT, Jorn Vernee <jver...@openjdk.org> wrote:

>> `checkValidStateRaw` synchronizes with `justClose` using handshakes so an 
>> opaque or higher load is only needed in `sharedSessionAlreadyClosed`. A 
>> `getOpaque` would probably be adequate. But I believe there is no formal 
>> restriction preventing the load from being hoisted out of the loop, so I 
>> decided to go for the strongest ordering in this exception-throwing case.
>
> 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`.

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

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

Reply via email to