Structured Concurrency: Writing Safer Concurrent Code with Coroutines...
summary
Argues that using C++20 coroutines with a lazy task type and composable algorithms yields deterministic, exception-safe concurrency: calls no longer implicitly start detached work, initial_suspend makes coroutines lazy, destructors can safely destroy unstarted frames, and joining happens without blocking. Demonstrates concrete algorithms—when_all / when_all_range for parallel results, when_windowed to bound concurrency, take_until for cancellation—and cites cppcoro and Folly implementations; shows the pattern removes dangling-reference bugs and avoids heap/lock overheads from eager futures.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 5:33Structured concurrency
- 12:18Object lifetimes
- 17:38Destructors
- 18:27Async Operations
- 22:44Why is this hard
- 25:57The solution
- 26:50Making a Coroutine start lazily
- 30:04Using an algorithm
- 32:03Error handling
- 35:37Cancellation
- 39:56The Future
- 42:12Summary
- 43:20Questions
related talks
01h 30mC++ Coroutines and Structured Concurrency in Practice
01h 16mConcurrency Approaches: Past, Present, and Future
01h 05m“Concurrency, Parallelism and Coroutines”
01h 32mConcurrency, Parallelism and Coroutines
58m“Introduction to C++ Coroutines"
32mStructured Concurrency: The paradigm shift
52mCoroutines: C++ vs Rust
48m“Coroutines: what can't they do?”
