You've already seen that most code that uses Boost.Asio will use some instance of
io_service is the most important class in the library; it deals with the operating system, waiting for all asynchronous operations to end, and then calling the completion handler for each such operation.
If you choose to create your application synchronously, you won't need to worry about what I'm about to show you in this section.
You can use
io_service instances in several ways. In the following examples, we have three asynchronous operations, two socket connections and a timer wait:
io_serviceand one handler thread:
io_service service_; // all the socket operations are handled by service_ ip::tcp::socket ...