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/Ivar/index.html

Module Picos_std_sync.IvarSource

An incremental or single-assignment poisonable variable.

Sourcetype !'a t

Represents an incremental variable.

Sourceval create : unit -> 'a t

create () returns a new empty incremental variable.

Sourceval of_value : 'a -> 'a t

of_value value returns an incremental variable prefilled with the given value.

Sourceval try_fill : 'a t -> 'a -> bool

try_fill ivar value attempts to assign the given value to the incremental variable. Returns true on success and false in case the variable had already been poisoned or assigned a value.

Sourceval fill : 'a t -> 'a -> unit

fill ivar value is equivalent to try_fill ivar value |> ignore.

Sourceval try_poison : 'a t -> exn -> Printexc.raw_backtrace -> bool

try_poison ivar exn bt attempts to poison the incremental variable with the specified exception and backtrace. Returns true on success and false in case the variable had already been poisoned or assigned a value.

Sourceval poison : 'a t -> exn -> Printexc.raw_backtrace -> unit

poison ivar exn bt is equivalent to try_poison ivar exn bt |> ignore.

Sourceval peek_opt : 'a t -> 'a option

peek_opt ivar either returns Some value in case the variable has been assigned the value, raises an exception in case the variable has been poisoned, or otherwise returns None, which means that the variable has not yet been poisoned or assigned a value.

Sourceval read : 'a t -> 'a

read ivar waits until the variable is either assigned a value or the variable is poisoned and then returns the value or raises the exception.

Sourceval read_evt : 'a t -> 'a Picos_std_event.Event.t

read_evt ivar returns an event that can be committed to once the variable has either been assigned a value or has been poisoned.

OCaml

Innovation. Community. Security.