RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]
Per Minborg
pminborg at openjdk.org
Thu Apr 3 12:57:57 UTC 2025
On Wed, 2 Apr 2025 19:22:28 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add info that Map#values and Map#entrySet are stable
>
> src/java.base/share/classes/java/lang/StableValue.java line 402:
>
>> 400: * race. Since stable functions and stable collections are built on top of
>> 401: * {@linkplain StableValue#orElseSet(Supplier) orElseSet()} they too are
>> 402: * thread safe and guarantee at-most-once-per-input invocation.
>
> Do we guarantee that there is a total order with respect to the suppliers that fail to return. You can take a look at the specification of [`std::call_once`](https://en.cppreference.com/w/cpp/thread/call_once)
>
>> All active calls on the same flag form a single total order consisting of zero or more exceptional calls, followed by one returning call. The end of each active call synchronizes-with the next active call in that order.
>> The return from the returning call synchronizes-with the returns from all passive calls on the same flag: this means that all concurrent calls to std::call_once are guaranteed to observe any side-effects made by the active call, with no additional synchronization.
I don't think we should promise this even though it might be the case.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2026937625
More information about the core-libs-dev
mailing list