Deciphering C++ Coroutines Part 2 - Mastering Asynchronous Control Flow
summary
Claims a practical pattern for turning C++20 stackless coroutines into a stackful async model by storing coroutine_handles in promises and linking them into a call-chain, using symmetric transfer to swap frames so callers resume in order, and treating the return object as both return and awaitable. Implements lazy Task-like types, a resume-caller awaitable, and promise-base propagation of a scheduler. Demonstrates debugger-friendly visualization (Visual Studio data watch + std::source_location) and working examples on the slides repository.
AI-written summary · about
chapters (13)
- 0:00C++ coroutines recap
- 5:40Async computation motivation
- 8:25Green threads vs coroutines
- 14:06Stackless coroutines challenges
- 21:56Coroutine stack data structure
- 27:02Final suspend and transfer
- 33:24Async IO scheduling
- 39:31Lazy task spawning
- 43:06Promise types for data flow
- 45:18Debugging call stacks
- 48:31Control flow manipulators
- 50:18Future standardization
- 51:42Q&A
related talks
01h 21mC++ Coroutines at Scale - Implementation Choices at Google
01h 06mthe asynchronous library
20mUnhandled rejections and other awaited promise tales
24mFormalizing Asynchronous Context
56mExecutors in C++
20mNode and Libuv and Strongloop
47mA Tale of Two Asyncs: Open Source Language Design in Rust and Node.js
34mStream into the Future
