RFR: 8343394: Make MemorySessionImpl.state a stable field [v4]

Per Minborg pminborg at openjdk.org
Tue Nov 5 08:41:34 UTC 2024


On Mon, 4 Nov 2024 21:57:39 GMT, ExE Boss <duke at 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


More information about the core-libs-dev mailing list