package picos_std

  1. Overview
  2. Docs
Sample libraries for Picos

Install

Dune Dependency

Authors

Maintainers

Sources

picos-0.5.0.tbz
sha256=862d61383e2df93a876bedcffb1fd1ddc0f96c50b0e9c07943a2aee1f0e182be
sha512=87805379017ef4a7f2c11b954625a3757a0f1431bb9ba59132202de278b3e41adbe0cdc20e3ab23b7c9a8c5a15faeb7ec79348e7d80f2b14274b00df0893b8c0

doc/picos_std.sync/Picos_std_sync/Semaphore/Counting/index.html

Module Semaphore.CountingSource

A counting semaphore.

Sourcetype t

Represents a counting semaphore.

Sourceval make : ?padded:bool -> int -> t

make initial creates a new counting semaphore with the given initial count.

Sourceval release : t -> unit

release semaphore increments the count of the semaphore.

  • raises Sys_error

    in case the count would overflow.

Sourceval acquire : t -> unit

acquire semaphore waits until the count of the semaphore is greater than 0 and then atomically decrements the count.

Sourceval try_acquire : t -> bool

try_acquire semaphore attempts to atomically decrement the count of the semaphore unless the count is already 0.

Sourceval get_value : t -> int

get_value semaphore returns the current count of the semaphore. This should only be used for debugging or informational messages.

OCaml

Innovation. Community. Security.