RFR: 8314480: Memory ordering spec updates in java.lang.ref

Brent Christian bchristi at openjdk.org
Thu Nov 30 00:53:04 UTC 2023


On Tue, 21 Nov 2023 22:46:32 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/ref/Reference.java line 489:
>> 
>>> 487:      * <p>If this reference was already enqueued (by the garbage collector, or a
>>> 488:      * previous call to {@code enqueue}), this method is <b><i>not successful</i></b>,
>>> 489:      * and returns false.
>> 
>> If we're going to talk about successful and unsuccessful calls, we should define what success is first. I guess that would be something like: if this ref is registered with a queue and not already enqueued, it is enqueued successfully and the method returns true. Otherwise, not successful, and returns false.
>
> This could be worded as a post condition, after the call the ref is enqueued with the queue; the return is true iff the ref was not previously enqueued.
> The enqueuing is not conditional (assuming the queue is non-null).

I'll give that some thought. The enqueuing is not conditional, but the _happens-before_ is...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16644#discussion_r1410031119


More information about the core-libs-dev mailing list