package picos_std

  1. Overview
  2. Docs
Sample libraries for Picos

Install

Dune Dependency

Authors

Maintainers

Sources

picos-0.6.0.tbz
sha256=3f5a08199cf65c2dae2f7d68f3877178f1da8eabf5376e15114e5a8958087dfa
sha512=ad24910c47ce614268c4268874bb918da7f8b5f03b3ad706bbf30323635262e94ddab6be24eaebbca706bfa82c0a517d4272b396459e020c185942125c9bdb7b

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.

ℹ️ This operation is not cancelable.

  • 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.