What are other timer APIs on Linux besides POSIX timers?

I want to create a timer on Linux, but due to some system limitations and design requirements, I cannot use the POSIX API.

Can someone kindly tell me what timer creation mechanisms are available on Linux except for POSIX timers? (timer_create, timer_settime, etc. to avoid)

Thanks in advance.

EDIT: PS: any mechanism that you provide, asking you to kindly give me useful links or link examples

NOTE. We cannot use a third-party library (for example, the ACE library), because our code is proprietary code.

+4
source share
3 answers

See my answer . One of the timers that I find useful is the timerfd_create () API provided in the Linux system call. This works well when your application is structured in an event loop.

+4
source

If you are looking for a third party, there is an ACE library that can be downloaded for free. They have timers, queues, threads, etc.

+2
source

The simplest and most portable way is probably using pthread_create and clock_nanosleep to implement your own timer. It should not contain more than 50 lines of code for something simple and, possibly, 100-150 for a completely general API with overflow counting, etc.

0
source

All Articles