RFR: 8374984: Convert workerUtils to use Atomic<T> [v2]
Kim Barrett
kbarrett at openjdk.org
Wed Jan 14 22:45:21 UTC 2026
On Wed, 14 Jan 2026 08:25:02 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
>> src/hotspot/share/gc/shared/workerUtils.cpp line 120:
>>
>>> 118: bool SubTasksDone::try_claim_task(uint t) {
>>> 119: assert(t < _n_tasks, "bad task id.");
>>> 120: return !_tasks[t].load_relaxed() && !_tasks[t].compare_exchange(false, true);
>>
>> This is one of those cases where `compare_set` is somewhat cleaner:
>>
>>
>> return !_tasks[t].load_relaxed() && _tasks[t].compare_set(false, true);
>
> And maybe the same for `all_tasks_claimed_impl`?
Agreed for both cases. Done.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29201#discussion_r2692320650
More information about the hotspot-gc-dev
mailing list