Modern C++ 23 Coroutines: Mastering Asynchronous Design with Awaitables, Generators, and Task Frameworks (High-Performance C++ Engineering) - Softcover

S. Lightner, Billie

 
9798258170330: Modern C++ 23 Coroutines: Mastering Asynchronous Design with Awaitables, Generators, and Task Frameworks (High-Performance C++ Engineering)

Synopsis

Callback hell is dead. Blocking threads is obsolete. But if you don't understand how the C++ compiler builds your coroutines, your systems will crash.

For years, asynchronous programming in C++ meant wrestling with inverted control flows, brittle state machines, and the massive overhead of std::future. The introduction of coroutines radically changed the language, allowing developers to write asynchronous code that looks and reads sequentially. But beneath the elegant co_await syntax lies a minefield of hidden compiler transformations, promise types, and invisible memory allocations.

Modern C++ 23 Coroutines is the definitive, uncompromising guide to mastering asynchronous design in C++. This book strips away the "compiler magic." It takes you deep into the internal machinery of the coroutine transform, teaching you exactly how the compiler builds state machines, manages the coroutine frame, and routes data through the Promise Object.

Whether you are building high-throughput network servers, asynchronous pipelines, or custom task schedulers, this book gives you the exact blueprints to write highly concurrent, zero-leak C++ code.

What You Will Learn Inside:

  • The Compiler Unmasked: Deconstruct the coroutine transform. Understand the exact lifetimes of the Coroutine Frame, the Promise Object, and the Coroutine Handle to permanently eliminate dangling references and silent memory leaks.
  • The Promise Contract & Awaitables: Take absolute control over suspension points. Write custom Awaitables from scratch, intercept data flow, and implement symmetric transfer to achieve tail-calling without stack overflows.
  • Generators and C++23: Build lazy, pull-based generators, manage nested yielding, and leverage the native C++23 std::generator for optimal ranges integration.
  • Task Frameworks & Schedulers: Do not rely on generic syntax. Build lazy and eager task types, and engineer custom single-threaded event loops and thread-pool schedulers featuring work-stealing and resume_on controls.
  • Structured Concurrency: Implement bulletproof when_all and when_any fan-out patterns. Master stop tokens and teardown ordering to prevent fire-and-forget coroutines from outliving their parents.
  • Async I/O and Networking: Wrap io_uring and epoll as native awaitables. Engineer a zero-allocation, massively scalable async TCP server that executes read and write operations via pure co_await.
  • Production Hardening: Learn how to force Heap Allocation Elision (HALO) so your coroutine frames never touch the heap, and discover techniques to reconstruct the broken stack traces inherent to coroutine debugging.
Do not write another asynchronous system relying on guesswork and compiler defaults. Take absolute control of your execution context.

Get your copy today and engineer asynchronous C++ systems that are fast, deterministic, and fiercely resilient.

"synopsis" may belong to another edition of this title.