Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good lightweight multiplatform C++ timer queue?

Tags:

c++

queue

timer

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.

like image 580
Milen A. Radev Avatar asked Apr 01 '26 00:04

Milen A. Radev


2 Answers

Boost::ASIO contains an asynchronous timer implementation. That might work for you.

like image 127
Len Holgate Avatar answered Apr 02 '26 13:04

Len Holgate


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.

like image 20
TonJ Avatar answered Apr 02 '26 13:04

TonJ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!