~/talk

C++ Coroutines - Don’t Try This at Home

Talkat ACCU 2024 · 2024-04-17..04-20· [c-and-cpp, concurrency]
slides:none on file

C++20 coroutines require explicit boilerplate: a heap-allocated coroutine frame, a coroutine_handle owning a promise_type that must implement initial_suspend/final_suspend/unhandled_exception and hold yielded or returned state; examples implement a radio-station generator, a pinball resumable action, and an average that co_returns a final value. Custom awaiters show how the caller can pass feedback into the coroutine (store score in promise and return it from await_resume). C++23’s std::generator replaces boilerplate for generators but other patterns still need explicit promise_type stores state and sometimes a custom awaiter passes data back. Compilers vary in support.

AI-written summary · about

  1. 0:00C++ coroutines intro
  2. 6:38Radio station with coroutines
  3. 14:27Compiler magic behind coroutines
  4. 21:13Promise type config
  5. 26:15Coroutine API implementation
  6. 35:34Coroutines in practice
  7. 41:00Challenges and boilerplate
  8. 43:34C++23 std::generator
  9. 49:43Pinball machine example
  10. 55:48Understanding awaitables
  11. 1:01:14Passing values coroutine-caller
  12. 1:10:13Nested coroutines lazy eval
  13. 1:19:21Making coroutines awaitable
  14. 1:25:00Summary & Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.