Module Fuseau.SchedulerSource

Scheduler that runs fibers.

The scheduler is responsible for running fibers that are ready, but it doesn't directly deal with timeouts, readiness events, etc. For these see Event_loop.

Sourcetype t

A scheduler

Sourceval active : t -> bool

Is the scheduler not finished yet?

Sourceval dispose : t -> unit

Delete the scheduler. Idempotent and thread-safe. This cancels the remaining fibers. The scheduler will stop running when they all terminate.

Sourceval n_tasks_since_beginning : t -> int

Number of tasks run so far in this scheduler.

Sourceval get_for_current_thread : unit -> t

Get scheduler from the current thread. This must be called from within a Fuseau fiber.

  • raises Failure

    if not run from within a fiber