23 #if defined _SYSTEM_POSIX_ 24 # include <linux/version.h> 25 # if (!(LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25))) 30 #include <sys/timerfd.h> 39 m_info =
new struct periodic_info;
50 int fd = timerfd_create(CLOCK_MONOTONIC, 0);
51 m_info->wakeups_missed = 0;
52 m_info->timer_fd = fd;
71 struct itimerspec itval;
75 itval.it_interval.tv_sec = sec;
76 itval.it_interval.tv_nsec = ns;
77 itval.it_value.tv_sec = sec;
78 itval.it_value.tv_nsec = ns;
79 ret = timerfd_settime(m_info->timer_fd, 0, &itval, NULL);
93 unsigned long long missed;
98 ret = read(m_info->timer_fd, &missed,
sizeof(missed));
101 perror (
"read timer");
105 m_info->wakeups_missed += missed;
virtual void makePeriodic()
PeriodicThreadImplTimerfd(const icl_core::TimeSpan &period)
virtual bool setPeriod(const icl_core::TimeSpan &period)
Repesents absolute times.
virtual void waitPeriod()
virtual bool setPeriod(const icl_core::TimeSpan &period)
Contains icl_core::thread::PeriodicThreadImplTimerfd.
virtual ~PeriodicThreadImplTimerfd()
virtual icl_core::TimeSpan period() const
icl_core::TimeSpan m_period