Boost logo

Boost Users :

From: Gavin Lambert (boost_at_[hidden])
Date: 2019-07-14 23:02:55

On 12/07/2019 12:42, Christopher Pisz 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?

I can't see any particular reason why this shouldn't work.

Have you tried it in older versions of Boost.Asio? It wouldn't surprise
me if somewhere in the switchover to io_contexts and executors,
something has broken the execution guarantees.

In particular I think timers are implemented with a helper thread, so
it's marshalling work between two different contexts, and it wouldn't
surprise me if there were a moment when the outer context doesn't have
any work but the inner context does.

Most apps wouldn't notice since they use a work/run loop to keep the
context running when there's no "work".

(I really think Asio has become too complicated for its own good.)

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