O'Reilly logo

Boost.Asio C++ Network Programming by John Torjo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Threading in Boost.Asio

When it comes to threading in Boost.Asio, we will talk about:

  • io_service: The io_service class is thread-safe. Several threads can call io_service::run(). Most of the time you'll probably call io_service::run() from a single thread that function is blocking until all asynchronous operations complete. However, you can call io_service::run() from several threads. This will block all threads that have called io_service::run(). All callbacks will be called in the context of any of the threads that called io_service::run(); this also means that if you call io_service::run() in only one thread, all callbacks are called in the context of that thread.
  • socket: The socket classes are not thread-safe. Thus, you should avoid doing such ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required