Coroutines 101
summary
Explains that coroutines provide cooperative multitasking inside one thread to avoid locks and share resources, demonstrates two concrete APIs: Boost.Coroutine2 (stackful) and std::coroutines (promise/handle-based), shows a working pipeline generator → prime filter → summation that stops when the sum crosses 100, adapts a legacy callback parser using stackful coroutines to return a parse tree without locks, and sketches an actor scheduler and iterative math generator; examples compile and run and show clean shutdown and required lifetime care.
AI-written summary · about
chapters (13)
- 0:00Introduction to coroutines
- 1:54Why use coroutines
- 3:38What coroutines really are
- 6:27How to use coroutines
- 10:18Boost coroutine API demo
- 14:54Standard library coroutines
- 18:44Standard library demo
- 21:39Stackful coroutines for parsers
- 25:15Safety considerations with coroutines
- 26:37Real-world coroutine examples
- 29:51Actor model with coroutines
- 30:33Mathematical software use case
- 31:44Q&A
