package fiber

  1. Overview
  2. Docs

Limit the number of jobs

type t
val create : int -> t

create n creates a throttler that allows to run n jobs at once

val size : t -> int

How many jobs can run at the same time

val resize : t -> int -> unit fiber

Change the number of jobs that can run at once

val run : t -> f:(unit -> 'a fiber) -> 'a fiber

Execute a fiber, waiting if too many jobs are already running

val running : t -> int

Return the number of jobs currently running