• C++ Coroutines: Understanding Symmetric Transfer

    A tweak was made to the design of coroutines in 2018 to add a capability called "symmetric transfer" which allows you to suspend one coroutine and resume another coroutine without consuming any additional stack-space. The addition of this capability lifted a key limitation of the Coroutines TS and allows for much simpler and more efficient implementation of async coroutine types without sacrificing any of the safety aspects needed to guard against stack-overflow. In this post will attempt to explain the stack-overflow problem and how the addition of this key "symmetric transfer" capability lets us solve this problem.
  • C++ Coroutines: Understanding the promise type

    In this post I look at the mechanics of how the compiler translates coroutine code that you write into compiled code and how you can customise the behaviour of a coroutine by defining your own promise type.
  • C++ Coroutines: Understanding operator co_await

    Understanding how the `co_await` operator works can help to demystify the behaviour of coroutines and how they are suspended and resumed. In this post I will be explaining the mechanics of the `co_await` operator and introduce the related 'Awaitable' and 'Awaiter' type concepts.
  • Coroutine Theory

    In this post I will describe the differences between functions and coroutines and provide a bit of theory about the operations they support. The aim of this post is introduce some foundational concepts that will help frame the way you think about C++ Coroutines.