C++ Boost ASIO simple periodic timer?


I want a very simple periodic timer to call my code every 50ms. I could make a thread that sleeps for 50ms all the time (but that’s a pain)… I could start looking into Linux API’s for making timers (but it’s not portable)…

I’d like to use boost.. I’m just not sure it’s possible. Does boost provide this functionality?


The second example on Boosts Asio tutorials explains it.
You can find it here.

After that, check the 3rd example to see how you can call it again with a periodic time intervall

Answered By – Default

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published