23 June 2023
C++ coroutines
C++ coroutines lab presentations. WORK IN PROGRESS
Presentations
- Problem domain
- Mechanics
- Scoped coroutines
- TODO discuss issue with reference parameters, lambda captures, pointers, string_views
- TODO the (invalid)
std::move
trick to call once - TODO the co_await by value trick
- TODO still )potential) scope issue
- TODO why not eager
- finall_suspend first
- the issue with eager initial_suspend when actually suspended later
- Trampoline
- Timers
- Structured concurency
- sane principles
- a child coroutine does not outlives its parent
- a coroutine runs uninterrupted until a co_await
- TODO: discuss the issue of detach/fire and forget
- lifetime
- error propagation
- TODO: discuss issue with blocking in bounded parallelism cases
- TODO: discuss issue with destructors blocking
- sane principles
- Cancellation
- hiding cancellation from function signature (e.g. see
co_await get_cancellation_token()
- hiding cancellation from function signature (e.g. see
- Nursery
- Threading models
- Windows Thread Pool
Bibliography
- spec N4775: relatively short, readable, but background info required
- Lewis Baker’s posts: long, not up to date, but really good background info required to understand coroutines
- Nathaniel J. Smith: Notes on structured concurrency, or: Go statement considered harmful
- C++ Coroutines at Scale - Implementation Choices at Google - Aaron Jacobs - C++Now 2024
- C++ Coroutines and Structured Concurrency in Practice - Dmitry Prokoptsev - C++Now 2024
- Structured Concurrency: Writing Safer Concurrent Code with Coroutines… - Lewis Baker - CppCon 2019
- CppCon 2018: G. Nishanov “Nano-coroutines to the Rescue! (Using Coroutines TS, of Course)