Glossary
This glossary defines terms used throughout the Capy documentation.
A
- Abandon
-
To give up a suspended coroutine that its holder cannot resume, for example when the execution context or strand holding it is destroyed. The coroutine’s segment is unwound from its owner without any frame delivering a result. See
abandonand Lifetime and Ownership. - Affinity
-
The binding of a coroutine to a specific executor. A coroutine with affinity to executor
exhas all its resumptions dispatched throughex. A task inherits its caller’s executor unless it is started with arunoverload that takes an executor. See Executors and Execution Contexts. any_executor-
A type-erased owning wrapper for executors. See
any_executorandexecutor_ref. - Await
-
To apply
co_awaitto an awaitable to obtain its result. The coroutine suspends unless the result is already available. - Awaitable
-
A type that can be used with
co_await. It either provides the awaiter functionsawait_ready(),await_suspend(), andawait_resume()directly, or yields an awaiter throughoperator co_await. - Awaiter
-
The object whose
await_ready(),await_suspend(), andawait_resume()the compiler calls when a coroutine awaits.
B
- Buffer
-
A contiguous region of memory. See
mutable_buffer(writable) andconst_buffer(read-only). - Buffer Sequence
-
A collection of buffers that can be iterated. Enables scatter/gather I/O with a single operation. See Buffer Sequences.
C
- Cancellation
-
Asking an in-progress asynchronous operation to stop early through a stop token. Operations complete with an error code that compares equal to
cond::canceled. See Stop Tokens and Cancellation. - Completion Handler
-
The callable passed to
run_asyncthat receives the task’s result or exception when the task finishes. - Composed Operation
-
An operation built from multiple primitive operations. For example,
readrepeatedly callsread_some()until the buffer is full. - ContextAwaitable
-
The concept for awaitables whose
await_suspendtakes the execution environment as a second argument. Every awaitable a Capy coroutine awaits must satisfy it. SeeContextAwaitableand The ContextAwaitable Protocol. - Continuation
-
The code that runs after an asynchronous operation completes. In Capy it is always a suspended coroutine, whose handle is wrapped in a
continuationthat executors can queue without allocating. - Coroutine
-
A function that can suspend and resume execution. Uses the
co_await,co_yield, orco_returnkeywords. See Introduction To C++20 Coroutines. - Coroutine Frame
-
The memory holding a coroutine’s local variables, parameters, and promise across suspensions. Capy allocates it through the frame allocator.
- Coroutine Handle
-
A low-level handle to a suspended coroutine, represented by
std::coroutine_handle<>.
E
- Environment
-
The executor, stop token, and frame allocator that a coroutine chain passes to each awaitable it awaits. It also names the owner of the current segment. Represented by
await_context. - EOF (End of File/Stream)
-
A condition indicating no more data is available. Signaled by
cond::eof. - Error Code
-
A lightweight error indicator. See
std::error_code. - Error Condition
-
A portable error classification. Enables comparing errors across categories. See
cond. - Event
-
A primitive that suspends any number of coroutines until it is set, then resumes all of them. See
async_event. - Execution Context
-
An object that owns the resources work runs on, such as threads, and the services attached to them. It provides an executor. See
execution_contextandthread_pool. - Executor
-
An object that can dispatch or post coroutines for execution. Satisfies the
Executorconcept. executor_ref-
A type-erased, non-owning reference to an executor. It is the type tasks use to store the executor they resume on. See
executor_ref.
F
- Frame Allocator
-
The memory resource used to allocate coroutine frames. It travels with the environment and is installed in a thread-local slot while a coroutine runs. See Frame Allocators.
- Fuse
-
A test utility that injects errors at controlled points and reruns the test body, so every error path is exercised. See
test::fuse.
I
- I/O Awaitable
-
An awaitable that satisfies the
ContextAwaitableconcept. - I/O Backend
-
The code that performs I/O and reports completions, such as a wrapper over
epoll,io_uring, or IOCP. Capy provides none. A library such as Corosio supplies one, and a type-erased stream hides which one is in use. - Immediate
-
An awaitable that already holds its result and never suspends. Lets a function that sometimes completes synchronously return an awaitable without creating a coroutine. See
immediate.
L
- Lazy
-
A coroutine that does not run until it is awaited or started.
taskis lazy.
M
- Mock Stream
-
A test double that satisfies the stream concepts and lets a test control the data and errors each read or write sees. See
test::stream,test::read_stream,test::write_stream, and Mock Streams. - Move-Only
-
A type that can be moved but not copied. Tasks and type-erased streams are move-only.
- Mutex
-
A primitive that lets one coroutine at a time hold a lock, suspending the others instead of blocking their threads. See
async_mutex.
O
- Owner
-
The coroutine that started a segment. It stays suspended above the segment until the segment’s top task finishes, and it unwinds the segment if the segment is abandoned. See
chain_owner.
P
- Post
-
Queuing a coroutine on an executor to run later, never inline.
- Primitive Operation
-
A basic I/O operation like
read_some()orwrite_some()that may transfer any amount of data. - Promise
-
The object inside a coroutine frame that controls the coroutine’s behavior, such as how it starts, finishes, and stores its result.
Q
- Quitter
-
A task-like coroutine type that unwinds early when its stop token is triggered, instead of completing its body. See
quitter.
R
- Result
-
The value a coroutine produces when it completes.
results-
The result type for Capy operations: a
std::tupleof an error code followed by optional payload values. Supports structured bindings. Seeresultsand The results Type. - Resume
-
Continuing execution of a suspended coroutine.
run-
Awaiting a task from inside a coroutine with a different executor, stop token, or frame allocator. When the executor differs, the parent resumes on its own executor after the task finishes. See
run. run_async-
Starting a task from outside a coroutine, such as from
main. Seerun_asyncand Starting Coroutines.
S
- Safe Resume
-
Resuming a coroutine while saving and restoring the thread-local frame allocator, so coroutines do not overwrite each other’s allocator. Custom executor event loops must use
safe_resume. - Scatter/Gather I/O
-
Reading into or writing from multiple non-contiguous buffers in a single operation.
- Scheduler
-
The P2300
std::executionconcept for objects that create senders. In Capy, the object that schedules work is an executor. - Segment
-
A run of coroutines started together. One segment is the task
run_asyncstarts and everything it awaits. A taskrunstarts on another executor forms its own segment, as does each branch ofwhen_allorwhen_any. See Lifetime and Ownership. - Sender
-
A P2300
std::executionobject describing asynchronous work, connected to a receiver to run it. See Bridging a P2300 Sender. - Service
-
A polymorphic component owned by an execution context. Provides shared functionality. See
execution_context::use_service(). - Start
- Stop Token
-
A mechanism for requesting cancellation. See
std::stop_token. - Strand
-
An executor adaptor that ensures coroutines dispatched through it never run concurrently, even on a multi-threaded execution context. Eliminates data races without mutexes. See
strandand Strand Serialization. - Stream
-
A sequence of bytes that can be read or written incrementally. See the
ReadStream,WriteStream, andStreamconcepts and Streams. - Structured Bindings
-
C++17 feature for unpacking tuple-like types:
auto [a, b] = expr; - Suspend
-
Pausing execution of a coroutine, yielding control to the caller or resumer.
- Symmetric Transfer
-
Resuming another coroutine directly from
await_suspendby returning its handle, so that the stack does not grow. A finished task returns to its parent this way. - System Context
-
The process-wide thread pool used when no explicit execution context is supplied. See
get_system_context.
T
- Task
-
A lazy coroutine that produces a result. See
taskand The task Type. - Thread Pool
-
An execution context that runs work on a fixed number of threads. See
thread_pool. - Thread Safety
-
The ability to use an object safely from multiple threads.
- Type-Erased
-
Describes a type that hides its concrete type behind a fixed interface, enabling runtime polymorphism without templates. See
any_stream,any_read_stream,any_write_stream, and Type-Erased Wrappers.
W
- Waker
-
A single-slot primitive that suspends one coroutine until a wakeup arrives from any thread. A wakeup that arrives before the coroutine waits is kept for its next wait. Used to connect external events, such as timers, to coroutines. See
async_waker. when_all-
Awaiting several tasks concurrently and completing when all of them have finished. The first failure requests stop on the other tasks. See
when_alland Concurrent Composition. when_any-
Awaiting several tasks concurrently and completing with the first one that succeeds. Stop is requested for the others, and all of them finish before it returns. A failing task does not stop the others. If every task fails, it completes with one of the failures. See
when_anyand Concurrent Composition. - Work
-
Pending operations that keep an execution context running.
- Work Guard
-
An object that keeps an execution context’s work count raised for its lifetime, so the execution context does not stop running. See
work_guard.
See Also
-
Reference: API reference documentation