RFR: 8366671: Refactor Thread::SpinAcquire and Thread::SpinRelease [v4]

Coleen Phillimore coleenp at openjdk.org
Fri Nov 14 18:56:07 UTC 2025


On Fri, 14 Nov 2025 15:01:17 GMT, Anton Artemov <aartemov at openjdk.org> wrote:

>> src/hotspot/share/utilities/spinCriticalSection.hpp line 56:
>> 
>>> 54: // A short section which is to be executed by only one thread.
>>> 55: // The payload code is to be put into an object inherited from the Functor class.
>>> 56: class SpinSingleSection {
>> 
>> Could this instead be a template <typename Function> instead and the code can pass a lambda to it rather than this Functor type?
>
> It can be done with a template and a lambda function. I changed the implementation in the latest commit. It does not look any better, however.

Actually it doesn't really look better with a lambda.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28264#discussion_r2528570773


More information about the hotspot-dev mailing list