On Wed, 4 Jun 2025 14:21:31 GMT, Johannes Bechberger <jbechber...@openjdk.org> 
wrote:

>> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 584:
>> 
>>> 582:   sev.sigev_notify = SIGEV_THREAD_ID;
>>> 583:   sev.sigev_signo = SIG;
>>> 584:   sev.sigev_value.sival_ptr = &t;
>> 
>> Why setting the address of `t` which is a local variable here?
>
> Because this is how the API works. You store the location where the timer 
> should be stored.
> 
> See https://www.man7.org/linux/man-pages/man2/timer_create.2.html for more 
> information.

Sorry where does it say that? I think you are looking at the example in that 
page which makes use of sival_ptr in the signal handler. In that example 
reading from that timer address in the handler is valid but for us we would be 
accessing invalid memory. Plus we are not really reading it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126787035

Reply via email to