About when it is called a handler in Boost.Asio

240 views Asked by At

I'm learning Boost.Asio. In the documentation we can see the following:

Asynchronous completion handlers will only be called from threads that are currently calling io_service::run().

I have only a thread (the main thread). In that thread, I call the io_service::run() function.

Suppose that the thread is busy when Asio call handler.

Is the handler called? Wait for the thread? Is it ignored?

Thank you

1

There are 1 answers

0
Juan Solo On

Well, I'm wrong.

The handler always will be called since you call one of these functions: run(), run_one(), poll() or poll_one()

My code was wrong. I used the run_one() function with a timer. The timer was failure.