package async_kernel

  1. Overview
  2. Docs
Monadic concurrency library

Install

Dune Dependency

Authors

Maintainers

Sources

async_kernel-v0.13.0.tar.gz
sha256=55a32c8b8e6aaaecb8357644515884367ec99b703fe8f984212b714a0e554c65
md5=d12b61a3f95325a511c50964bc9c819e

doc/async_kernel.limiter_async/Limiter_async/Resource_throttle/index.html

Module Limiter_async.Resource_throttle

A resource throttle holds a static list of n resources that are handed out in a round-robin fashion to up to n concurrent jobs. A resource given to create may be re-used many times in the lifetime of t but will never be used by more than one job at a time.

type 'a t
val sexp_of_t : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a t -> Ppx_sexp_conv_lib.Sexp.t
val create_exn : resources:'a list -> continue_on_error:bool -> ?burst_size:int -> ?sustained_rate_per_sec:float -> unit -> 'a t
val max_concurrent_jobs : _ t -> int
val enqueue_exn : 'a t -> ?allow_immediate_run:bool -> ('a -> unit) -> unit
val enqueue' : 'a t -> ('a -> 'b Async_kernel.Deferred.t) -> 'b Outcome.t Async_kernel.Deferred.t
include Common with type 'a t := 'a t
val kill : _ t -> 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 : _ t -> bool

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

val to_limiter : _ t -> limiter

Convert to a limiter

OCaml

Innovation. Community. Security.