2

Does somebody has any idea of HT Timer in Linux? I will be glad if someone shares some code snippets with examples of how to implement the same.

Thanks in advance

user229044
  • 222,134
  • 40
  • 319
  • 330
RajSanpui
  • 10,946
  • 31
  • 77
  • 143

2 Answers2

2

Depends on your application type.

For event-driven applications your event notification library (like libevent) should provide timer scheduling functionality.

There is also POSIX timer_create() function, that can deliver timer expiry as a signal or a callback in another thread. Latest Linux provides timerfd mechanism to deliver timer expirations through a regular file descriptor that can be registered with select()/poll()/epoll().

Maxim Egorushkin
  • 125,859
  • 15
  • 164
  • 254
1

Here similar question with sample code for clock_gettime().

Community
  • 1
  • 1
Sergei Nikulov
  • 4,951
  • 22
  • 35