package async_kernel

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Limiter_async.ThrottleSource

Implements a basic throttle meant to bound the number of jobs that can concurrently run. Additionally the ~burst_size and ~sustained_rate_per_sec arguments can be used to control how many jobs can be spawned in a burst, and how quickly jobs can be spawned over time. If these options are not given to create_exn they are unbounded.

concurrent_jobs_target is the desired maximum number of concurrent jobs. If the value is never changed, then this is in fact a hard upper bound. The value is mutable, however, and so may be violated temporarily if the value is reduced.

Sourcetype t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
Sourcetype _ u = t
Sourceval create_exn : concurrent_jobs_target:int -> continue_on_error:bool -> ?burst_size:int -> ?sustained_rate_per_sec:float -> unit -> t
Sourceval concurrent_jobs_target : t -> int
Sourceval num_jobs_waiting_to_start : t -> int
Sourceval num_jobs_running : t -> int
Sourceval enqueue_exn : t -> ?allow_immediate_run:bool -> ('a -> unit) -> 'a -> unit
Sourceval enqueue' : t -> ('a -> 'b Async_kernel.Deferred.t) -> 'a -> 'b Outcome.t Async_kernel.Deferred.t
include Common with type 'a t := 'a u
Sourceval kill : _ u -> unit

kills t, which aborts all enqueued jobs that haven't started and all jobs enqueued in the future. If t has already been killed, then calling kill t has no effect. Note that kill does not affect currently running jobs in any way.

Sourceval is_dead : _ u -> bool

is_dead t returns true if t was killed, either by kill or by an unhandled exception in a job.

Sourceval to_limiter : _ u -> limiter

Convert to a limiter

OCaml

Innovation. Community. Security.