Skip to main content

Module execution

Module execution 

Source
Expand description

Runtime hints passed from the executor to codecs and filters.

An ExecutionContext carries advisory information — today only a thread budget — that codecs can use to tune their internal parallelism. Codecs that don’t care can ignore it; the default trait method on Decoder / Encoder is a no-op.

§Threading contract

The context is the single threading authority for a codec:

  • A codec runs serial until told otherwise — before set_execution_context is called (or when it never is), internal fan-out is one worker.
  • Every internal fan-out is bounded through ExecutionContext::effective_workers, never by querying the host directly. Host-derived budgets are the caller’s decision, made by constructing the context with ExecutionContext::auto.
  • Threading stays optional: a codec with no internal parallelism simply keeps the default no-op trait method, and callers must always work with a codec that runs serial regardless of the budget they granted.

Structs§

ExecutionContext
Advisory runtime information handed to a codec after construction.