P4003R0 — Coroutines for I/O (7 items) LEWG
Vinnie Falco, Steve Gerbino, Mungo Gill
This paper proposes the IoAwaitable protocol, a coroutine-native execution model for asynchronous I/O built directly on C++20 language features. The protocol consists of two concepts (IoAwaitable and IoRunnable), a type-erased executor (executor_ref), and thread-local frame allocator propagation, derived from a complete working networking library implementing timers, sockets, DNS, TLS, and HTTP. The design propagates executor, stop token, and frame allocator through coroutine chains without polluting function signatures, enabling ergonomic, high-performance I/O with compile-time protocol verification.

References — Anthropic Citations API

[1]
"Date: 2026-02-22" / "R0: March 2026 (pre-Croydon mailing)"
[2]
"During a 100ms network round-trip, a modern CPU could have executed 300 billion instructions. "
[3]
"The standard library already accepted this tradeoff: std::pmr::get_default_resource() is a process-wide thread-local allocator channel, adopted in C++17."
[4]
"// Callback-based async (traditional style) socket.async_read(buffer, [](error_code ec, size_t n) { if (!ec) { // Process data, then start another read... socket.async_read(buffer,..."
[5]
"template< Executor Ex, class... Args > unspecified run( Ex ex, Args&&... args );"
Summary: P4003R0 proposes a coroutine-based framework for asynchronous I/O in the C++ standard library, built around a task coroutine type, an executor model, and primitives for structured concurrency including spawn, run, and channel. The design targets network programming and aims to replace callback-based async patterns with coroutine equivalents.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.