package async_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val create_exn : burst_size:int -> sustained_rate_per_sec:float -> continue_on_error:bool -> ?in_flight_limit:int -> ?initial_burst_size:int -> unit -> t
val enqueue_exn : t -> ?allow_immediate_run:bool -> int -> ('a -> unit) -> 'a -> unit

enqueue_exn t x f a enqueues an immediate job consuming x tokens, running f on input a.

if allow_immediate_run is true then f is allowed to run within the same async job as enqueue_exn iff there are enough tokens available to fully run the job and there are no other previously enqueued jobs that have not run. If this is the case, it is run before enqueue_exn returns. Otherwise no part of f is run before enqueue_exn returns.

If there is a failure associated with this job then the exception will be raised to the monitor in scope when enqueue_exn is called. Note that it may fail for a number of reasons, including f throws an exception, the limiter is killed, or the number of tokens requested is larger than the burst size.

val enqueue' : t -> int -> ('a -> 'b Deferred.t) -> 'a -> 'b Limiter.Outcome.t Deferred.t

enqueue' t x f a enqueues a deferred job consuming x tokens, running f on input a. No part of f is run before enqueue' returns.

type 'a u = t

Include Common, with the hack to remove the type parameter

include Limiter.Common with type 'a t := 'a u
val 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.

val is_dead : _ u -> bool

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

val to_limiter : _ u -> Limiter.limiter

Convert to a limiter

OCaml

Innovation. Community. Security.