From Async I/O to Senders and Receivers
summary
Shows why C++26 adds senders/receivers: coroutines make async code readable but still allocate on the heap and don’t model lifetime or error paths cleanly, so sender chains map OS non‑blocking I/O onto a reactor + operation_state model. Demonstrates non‑blocking connect/accept/send/recv, a receive_exact operation that stores the header in the operation state, scheduling 10k connections on one reactor thread, and switching heavy work to a thread pool with continuation-on schedulers; the examples compile into working pipelines.
AI-written summary · about
chapters (18)
- 0:00Introduction and motivation
- 1:06Why avoid blocking threads
- 3:18Blocking IO example
- 7:55Non-blocking IO setup
- 12:12Non-blocking API complexity
- 17:55Event loop and reactor pattern
- 20:45Lambda-based callbacks
- 23:11Manual state machines
- 26:22Coroutines in C++20
- 28:48Why senders and receivers
- 31:16Sender pipelines explained
- 36:34Sender chain execution
- 37:36First sender example
- 40:04IO senders and transformations
- 45:47Scheduling across threads
- 48:39Error handling and branching
- 50:26Server-side sender chains
- 51:08Summary and Q&A
