Lecture: Applied C++20 Coroutines
There are a many excellent introductions to C++20 coroutines. However, beyond the introductory material, there are few examples of how to apply C++20 coroutines in practice. This talk goes beyond the introductory material by providing practical examples of how to design, debug and empirically evaluate coroutines. In particular, this talk shows how to develop a coroutine based web-server using CMake and Boost.Beast (with materials available on GitHub) and how this differs from the more familiar event-driven implementation. The performance of a number of approaches is compared and a series of observations are made.
The aim of this talk is to provide practical guidance for how C++20 coroutines can be used in real-world applications. The talk begins by clarifying a number of coroutine concepts before showing how coroutines can be used to implement a web-server and how this differs from the more conventional call-back model (i.e. functions/lambdas). The talk will then show how the performance of coroutines can be evaluated and how new features from C++23 can be used to alleviate practical concerns. The talk will conclude with an update on coroutines for C++23, as well as a look ahead to C++26.
This talk is suitable for users of all levels who are interested in C++20 coroutines (i.e. sufficient introductory material will be covered to make the talk standalone). The slides and example code will be made available on the author's GitHub page. page.
- How to Use C++20 Coroutines for Networking
- C++20 + Lua = Flexibility
- Combining Modern C++ and Lua
- GitHub Materials