Boost logo

Boost Users :

From: degski (degski_at_[hidden])
Date: 2019-07-12 04:59:56

On Fri, 12 Jul 2019 at 03:43, Christopher Pisz via Boost-users <
boost-users_at_[hidden]> wrote:

> I am trying to perform a task on an interval and I made a POC using
> boost::asio::steady_timer. When I debug it, it only performs the callback
> once and does not fire again. I am not sure what I am doing wrong. Any
> suggestions?

Why would it 'fire' more than once, there is no loop?

int main() {
    boost::asio::io_context ioContext;
    auto pooper = Pooper(ioContext);
    while ( true ) {
    std::cerr << "Exited..." << std::endl;

Now it will poop till you drop.

Other than that, this appears to be [you don't state what you would like to
achieve] some kind of event-loop, where you suspend till the next frame.
You can suspend the current thread with std::this_thread::sleep_for (
std::chrono::milliseconds ( milliseconds_to_sleep ) ); or
std::this_thread::sleep_until ( some_time_point_in_the_future ); using just
std-lib facilities. Having said that, have a look at SFML (, which has all those things, event-loop,
event-polling, mouse, touch, joy-stick, sound, image rendering, window
creation etc.


"Anyone who believes that exponential growth can go on forever in a finite
world is either a madman or an economist" - Kenneth E. Boulding

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at