Skip to content

Move pthread and timerfd ticker implementations to separate files

Addresses #22806 (closed).

Changes:

  • All timerfd related code has been removed from rts/posix/ticker/Pthread.c.
  • A new file has been created in rts/posix/ticker/TimerFd.c that contains a version of ticker that is purely using the timerfd method.
  • In ticker.c:
    • an extra #define is created called USE_TIMERFD_FOR_ITIMER. This is set if HAVE_SYS_TIMERFD_H is set. The previous condition that also checked defined(linux_HOST_OS) has been removed since NetBSD also has timerfd since version 10.
    • Both netbsd_HOST_OS and linux_HOST_OS have a fallback to use the pthread version in case the user is using an older version of either OS that does not have timerfds yet.
    • The big #if section at the end has been altered to also check USE_TIMERFD_FOR_ITIMER. If timerfd is available we always use that, otherwise we go down the list in order as before.

Merge request reports