Index of articles exploring C++ coroutines

What would it mean to create your own coroutine framework?

This series of articles/presentations is reviving an attempt to explore C++ coroutines that I worked on and off from 2023 onwards. It is a learning journey that covers interesting, but less common parts of C++.

Ivan: “This is not the C++ I’m used to see”

There are multiple goals. There is the indirect goal of generally learning about concurrency, about C++, but also specifically answering the question “what would it take to write a library that can do concurrency in C++, potentially involving coroutines”?

WORK IN PROGRESS

Presentations

Bibliography

TODO - topics to cover

  • Cancellation
    • hiding cancellation from function signature (e.g. see co_await get_cancellation_token()
  • Trampoline
  • Timers
  • Threading synchronization in await_suspend
    • none (no cancellation)
    • mutex
    • atomic bool
  • C++ coroutine weak points
    • weak allocation control: have allocator, but allocation size is runtime info
      • no option to allocate on stack e.g. for a know type can control allocation on stack or heap (std::unique_ptr)
    • resume and destroy mechanisms are indirect calls: call a function that fetches a function pointer that makes a switch
    • a large vocabulary of terms: learning curve obstacle
  • senders receivers
    • compare example with read size then data (senders vs. coroutine)
    • design by committee (poorly explained, e.g. alternatives not explained)
      • customization points overload
  • Windows Thread Pool