I have written a program that runs on Linux and uses sigevent and timer_create in order to have a callback function being called perdiodically at a specified frequency. Now, I want the program to be portable (Windows and Linux), so the long way to do it is to use #ifdefs and use Windows equivalent functionality.
AFAIK, the equivalent on windows would be TimerQueueTimer.
I know this is a OS service, but just like thread, it can be made portable via a library like Boost C++.
The question is: do you know if there is such things in the Boost C++ library, or maybe in POCO or other respectable library?
If it is absent, then is there anything preventing the presence of such thing in a portable library?
FYI, boost::asio::deadline_timer is not what I am looking for, it must be a service that calls periodically a callback function with the same precision as timer_create and TimerQueueTimer.
POCO has a multi-threaded Timer class that runs TimerTask(s). Basically you override a TimerTask’s run() method with what you want to do when the timer expires. Multiple tasks can be added to the Timer object which spawns a thread to sequentially run all pending tasks. The tasks can be one-time or interval repeatable.
Not sure if it meets all of your needs but it is worth looking at.