What I'm looking for is a simple timer queue possibly with an external timing source and a poll method (in this way it will be multi-platform). Each enqueued message could be an object implementing a simple interface with a virtual onTimer() member function.
Boost::ASIO contains an asynchronous timer implementation. That might work for you.
There is a nice article in CodeProject, here, that describes the various timers available in Windows, and has chapters titled "Queue timers" and "Make your own timer".
For platform independence, you'd have to make implementations for the different platforms inside #ifdef -- #endif pairs. I can see nothing less ugly than that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With