Silk

silk/local_scheduler

Deterministic single-threaded execution for structured Fibers.

When to use

Use execute at an application entry point to run one lazy program that uses the silk.scheduler.Scheduler service.

Details

Each call creates fresh task storage and a FIFO ready queue. The root is task zero and uses the same Execution<()> storage as every child. execute returns only after the root terminates.

Import as LocalScheduler with import silk.local_scheduler.

Public declarations: 4.

LocalScheduler

pub struct LocalScheduler

A reusable deterministic single-threaded Scheduler provider.

Details

Each call to execute creates fresh task storage and readiness state.

StalledError

pub struct StalledError

Reports that no task is ready while the root is incomplete.

Details

execute cancels and releases the incomplete task tree before it raises this error.

make

pub fn make() -> LocalScheduler

Constructs a reusable local Scheduler value.

impl Copy for NoLink

impl Copy for TaskLink

Implementation Scheduler.Scheduler for SchedulerClient

impl Scheduler.Scheduler for SchedulerClient

Operation prepare

prepare = SchedulerClient.prepareChild

execute

pub effect fn execute<A, E>(self: &mut silk/local_scheduler.LocalScheduler, program: once Effect<A ! E ? &mut silk/scheduler.Scheduler>) -> A ! E | OutOfMemoryError | StalledError

Runs one lazy root program under this Scheduler and returns its typed outcome.

Details

The root becomes task zero. This operation owns all per-run task storage, provides one distinct Scheduler client to each task, and dispatches ready tasks in FIFO order. Before it returns a root value or raises a typed error, it cancels every unfinished descendant and releases the run state. If the root is incomplete when no task is ready, it performs the same cleanup and raises StalledError.

On this page