On Wed, 22 Jul 2026 02:47:05 GMT, David Holmes <[email protected]> wrote:

>> The `mutexes` field is accessed using `volatile` semantics, as that field is 
>> declared as `volatile`. I think this gives us the visibility/ordering we are 
>> looking for. I.e., if the value is set and then `mutexes` is set to `null` 
>> then, if we see `mutexes == null` (using `volatile` semantics), we are 
>> guaranteed to see the value.
>
> As I said "not obvious". :) So we have:
> 
> set(array, index, mutex, newValue);  // putReferenceRelease of newValue
> putReferenceVolatile(mutexes, offset, TOMB_STONE);
> mutexes = null; // volatile write
> 
> Thanks for clarifying.

We should revisit this and make the semantics clearer. Either via comments or 
by always using Unsafe for access.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31979#discussion_r3645086549

Reply via email to