Skip to main content

Crate vthread_stack

Crate vthread_stack 

Source
Expand description

Private, unsupported stack backend for vthread; not an independent public API.

Direct downstream use has no compatibility contract. Cleanup mount callbacks are runtime integration hooks and must succeed. A persistent mount failure during lexical scope exit aborts: borrowed executable stacks cannot safely escape their environment.

Layers, lowest first:

  • stack_unix and stack: guard-page-backed mappings stamped with a pool identity.
  • arch: per-target context switch and first-frame fabrication, nothing more.
  • entry and context: the entry closure and control block at the top of each stack, and the command and outcome protocol between a carrier and its fiber.
  • engine: the fiber lifecycle state machine, including forced reclamation.
  • mount, fiber, lease, scoped, and pool: the carrier-facing ownership model the scheduler consumes.

Structs§

Fiber
One carrier-local stackful execution context.
FiberLease
An internal carrier-local lease; scope exit revokes its executable stack.
FiberScope
Lexical ownership for a bounded set of borrowed, non-Send stacks.
MappedStack
One private anonymous mapping whose lowest page is an inaccessible guard.
ParkRequest
Scheduler data supplied when a task parks.
ParkToken
Identity for one generation of a parking operation.
StackPool
A bounded cache of guard-page-backed stacks.
StackPoolSnapshot
Operational counters for a stack pool.

Enums§

FiberState
The outcome of mounting a fiber once.
Resume
A carrier decision delivered to the operation that suspended the fiber.
SuspendError
Why a requested fiber suspension could not safely start.
Suspension
A reason a mounted fiber returned control to its carrier.

Constants§

STACK_ALIGNMENT
Required stack pointer alignment at call boundaries on both supported targets.

Functions§

fiber_scope
Runs a lexical borrowed-stack owner; leaked leases are inert after this returns.
suspend
Suspends the currently mounted fiber.