P0876R22 — fiber_context - fibers without scheduler (10 items) LEWG, LWG, CWG
Oliver Kowalke, Nat Goodspeed
This paper proposes a minimal API, std::fiber_context, that enables stackful symmetric context switching without requiring a scheduler. The design avoids global variables by synthesizing and passing fiber_context objects representing suspended fibers, mandates per-fiber exception state for std::uncaught_exceptions() and std::current_exception(), and provides the low-level building block upon which higher-level facilities such as coroutines, cooperative multitasking, and generators can be constructed. Full standard wording is provided targeting inclusion in C++29.

References — Anthropic Citations API

[1] chars 100401–100524
"— end note ] — Let deleter_copy be an object of type decay_t direct-non-list-initialized with std::forward(deleter). "
[2]
"void resume_next( filament& fila){ std::move(fila.f_).resume_with([this](fiber_context&& f)->fiber_context{ f_=std::move(f); return {}; } }"
[3] chars 97359–98599
"32.12.2 Header synopsis [fiber.context.syn] namespace std { // [fibercontext], class fiber_context class fiber_context; } 33 32.12.3 Class..."
[3] chars 97359–98599
"32.12.2 Header synopsis [fiber.context.syn] namespace std { // [fibercontext], class fiber_context class fiber_context; } 33 32.12.3 Class..."
[4] chars 99551–99671
"6 Error conditions:resource_unavailable_try_again – the system lacked the necessary resources to prepare another fiber. "
[4] chars 101345–101465
"6 Error conditions:resource_unavailable_try_again – the system lacked the necessary resources to prepare another fiber. "
[5] chars 99551–99671
"6 Error conditions:resource_unavailable_try_again – the system lacked the necessary resources to prepare another fiber. "
[5] chars 101345–101465
"6 Error conditions:resource_unavailable_try_again – the system lacked the necessary resources to prepare another fiber. "
[6] chars 101876–102069
"2 Returns:*this 32.12.3.2 Members [fiber.context.mem] template fiber_context resume_with(Fn&& fn) && ; The operation of resume_with() involves at least two and possibly three fibers. "
[7] chars 42646–43131
"f1 f1.resume() f2 f3 f4 f2.resume() self::suspend() f3.resume() self::suspend() f4.resume() self::suspend() 1 // hypothetical API 2 fiber_context f4{[]{ 3 self::suspend(); 4 }}; 5 fiber_context..."
[8] chars 43179–43243
"At line 2 fiber f4 calls its suspend operation self::suspend(). "
Summary: P0876R22 proposes std::fiber_context, a low-level stackful context-switching primitive for C++ with no built-in scheduler, intended as a building block for coroutine and fiber libraries. The paper provides standard wording placing fiber_context in [thread] and includes motivating examples for symmetric, asymmetric, and generator-style fibers.
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.