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
  • 232,980
  • 40
  • 330
  • 338
RajSanpui
  • 11,556
  • 32
  • 79
  • 146

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
  • 131,725
  • 17
  • 180
  • 271
1

Here similar question with sample code for clock_gettime().

Community
  • 1
  • 1
Sergei Nikulov
  • 5,029
  • 23
  • 36