Documentation

Hale.Base.Control.Concurrent.Scheduler

GreenThread #

A positive natural number, reused from Control.Concurrent.

Equations
Instances For

    A lightweight green thread queued for execution.

    • id — unique identifier (monotonic, $\ge 1$).
    • action — the IO Unit closure to run.
    • token — cooperative cancellation.
    Instances For

      Scheduling #

      Submit a green thread to Lean's thread pool. Returns the Task that resolves when the action completes.

      Uses IO.asTask with default priority (pooled, not dedicated). This means the work is queued onto the bounded thread pool instead of spawning a new OS thread. Millions of tasks can be queued — they are just closures on the heap until a pool worker picks them up.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For