Module type Scheduler.S

type t
val create : ?max_domains:Base.int -> Base.unit -> t

create ~max_domains () creates a scheduler that spawns worker threads on no more than max_domains domains.

val stop : t -> Base.unit

stop t waits for pending tasks to complete and joins all worker domains. Attempting to schedule new tasks after calling stop will raise.

During stop, idle workers will not attempt to steal asynchronous tasks.

val is_stopped : t -> Base.bool

is_stopped t returns true if t has been stopped.

val parallel : t -> f:(t @ local -> 'a) @ once shareable -> 'a

parallel t ~f creates an implementation of parallelism backed by t, applies f, and waits for it to complete.