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

Quan Anh Mai qamai at openjdk.org
Fri Nov 1 10:08:30 UTC 2024


On Fri, 1 Nov 2024 08:55:09 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   wait for the close operation to complete on acquire failures
>
> src/java.base/share/classes/jdk/internal/foreign/SharedSession.java line 90:
> 
>> 88:         }
>> 89: 
>> 90:         STATE.setOpaque(this, CLOSED);
> 
> Why are we using opaque semantics here and not volatile?

Because this variable is not used as a synchronization device, so a stronger order is unnecessary. We still need the store to be observed by other threads when they fail an `acquire` or a `close` so opaque is appropriate here.

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

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


More information about the core-libs-dev mailing list