On Fri, 12 Jul 2019 at 03:43, Christopher Pisz via Boost-users <boost-users@lists.boost.org> 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 ) {
         pooper.Run();
        ioContext.run();
    }
    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 (https://www.sfml-dev.org/), which has all those things, event-loop, event-polling, mouse, touch, joy-stick, sound, image rendering, window creation etc.

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