package balancer

  1. Overview
  2. Docs

Utilities for concurrency and thread safety

module type INT = sig ... end
module type COUNTER = sig ... end

An atomic counter

module Counter (I : INT) : COUNTER

Builds Atomic Counters from Integers

module Counter32 : COUNTER with type elt = int32 and type t = int32 ref
module Counter64 : COUNTER with type elt = int64 and type t = int64 ref
module SyncVar : sig ... end

Thread safe mutable that provides the gaurentees of a Multi Reader single Writer RW mutex, it handles locking and unlocking on it's own so you don't have to touch the mutex

val ensure : 'a Lwt.t -> (unit -> unit) -> 'a Lwt.t

Run a function that is ran after the promise is completed, whether it's successful or not