package picos_std

  1. Overview
  2. Docs

A binary semaphore.

type t

Represents a binary semaphore.

val make : ?padded:bool -> bool -> t

make initial creates a new binary semaphore with count of 1 in case initial is true and count of 0 otherwise.

val release : t -> unit

release semaphore sets the count of the semaphore to 1.

ℹ️ This operation is not cancelable.

val acquire : t -> unit

acquire semaphore waits until the count of the semaphore is 1 and then atomically changes the count to 0.

val try_acquire : t -> bool

try_acquire semaphore attempts to atomically change the count of the semaphore from 1 to 0.

OCaml

Innovation. Community. Security.