Home > OS >  Do boost::asio c 20 coroutines support multithreading?
Do boost::asio c 20 coroutines support multithreading?

Time:01-22

Do boost::asio c 20 coroutines support multithreading?

The boost::asio documentation examples are all single-threaded, are there any multithreaded examples?

CodePudding user response:

Yes.

In Asio, if multiple threads run execution context, you don't normally even control which thread resumes your coroutine.

You can look at some of these answers that ask about how to switch executors mid-stream (controlling which strand or execution context may resume the coro):

  • enter image description here

  • Related