RFR: 8369631: Assess and remedy any unsafe usage of the sr_semaphore Semaphore in the Posix signal code [v2]
Kim Barrett
kbarrett at openjdk.org
Thu Oct 16 16:12:59 UTC 2025
On Wed, 15 Oct 2025 01:27:37 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Replace the statically allocated "semaphore" with a pointer and lazily initialize it. I chose this approach as we already have a second Semaphore declared that way.
>>
>> Testing:
>> - tiers 1-3 sanity
>>
>> Thanks.
>
> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>
> Switch to DeferredStatic per Kim's request
src/hotspot/os/posix/signals_posix.cpp line 173:
> 171: static DeferredStatic<OSXSemaphore> sr_semaphore;
> 172: #else
> 173: static DeferredStatic<PosixSemaphore> sr_semaphore;
[pre-existing] Oh, ick. Please remove the indentation for the definitions of sr_semaphore. In the context of this diff I thought these were declarations at class scope, and was quite confused because I couldn't find a definition. Nope, these are at file scope, and *are* definitions. (This might be what is confusing @stefank about how they are/were being constructed.)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27762#discussion_r2436605887
More information about the hotspot-runtime-dev
mailing list