Summary
In this chapter, you've seen how to use C++ coroutines for writing asynchronous tasks. To be able to implement the infrastructure in the form of a Task
type and a sync_wait()
function, you needed to fully understand the concept of awaitable types and how they can be used to customize the behavior of coroutines in C++.
By using Boost.Asio, we could build a truly minimal but fully functional concurrent server application executing on a single thread while handling multiple client sessions.
Lastly, I briefly introduced a methodology called structured concurrency and gave some directions for where you can find more information about this topic.
In the next chapter, we will move on to explore parallel algorithms, which are a way to speed up concurrent programs by utilizing multiple cores.