Skip to content

Commit

Permalink
reactor: access sigevent.sigev_notify_thread_id with a macro
Browse files Browse the repository at this point in the history
sigev_notify_thread_id is defined as a macro by musl libc, FreeBSD, and the Linux kernel.
The macro is for accessing the corresponding field in sigevent.

see https://sourceware.org/bugzilla/show_bug.cgi?id=27417
  • Loading branch information
a16bitsysop committed Sep 14, 2023
1 parent 982690e commit bbe1af3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/reactor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,10 @@ cpu_stall_detector_posix_timer::cpu_stall_detector_posix_timer(cpu_stall_detecto
struct sigevent sev = {};
sev.sigev_notify = SIGEV_THREAD_ID;
sev.sigev_signo = signal_number();
sev._sigev_un._tid = syscall(SYS_gettid);
#ifndef sigev_notify_thread_id
#define sigev_notify_thread_id _sigev_un._tid
#endif
sev.sigev_notify_thread_id = syscall(SYS_gettid);
int err = timer_create(CLOCK_THREAD_CPUTIME_ID, &sev, &_timer);
if (err) {
throw std::system_error(std::error_code(err, std::system_category()));
Expand Down

0 comments on commit bbe1af3

Please sign in to comment.