package picos

  1. Overview
  2. Docs

A condition implementation for Picos.

ℹ️ This intentionally mimics the interface of Stdlib.Condition. Unlike with the standard library condition variable, blocking on this condition variable allows an effects based scheduler to run other fibers on the thread.

type t

Represents a condition variable.

val create : ?padded:bool -> unit -> t

create () return a new condition variable.

val wait : t -> Mutex.t -> unit

wait condition unlocks the mutex, waits for the condition, and locks the mutex before returning or raising due to the operation being canceled.

ℹ️ If the fiber has been canceled and propagation of cancelation is allowed, this may raise the cancelation exception.

val signal : t -> unit

signal condition wakes up one fiber waiting on the condition variable unless there are no such fibers.

val broadcast : t -> unit

broadcast condition wakes up all the fibers waiting on the condition variable.

OCaml

Innovation. Community. Security.