package mvar

  1. Overview
  2. Docs
Threadsafe mutable variables for Unix threads

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mvar.1.0.0.tar.gz
sha256=089be6f7715cb631fa9e35e6c645077b00c4d242e7669c0d648f47d2d5c4d6ea
md5=a093c88dbcce7085ed1d673953ae78bd

doc/mvar/Mvar/index.html

Module MvarSource

Sourcetype 'a t
Sourceval create_empty : unit -> 'a t

Create an empty mvar.

Sourceval create : 'a -> 'a t

Create an mvar containing a value.

Sourceval take : 'a t -> 'a

Wait until mvar holds a value, then return it and leave the mvar empty.

Sourceval try_take : 'a t -> 'a option

Non-blocking take - if the mvar holds no value, return None.

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

Wait until the mvar is empty, then put the supplied value in the mvar.

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

Non-blocking put - if the mvar is empty the put the supplied value in the mvar, otherwise return false.

Sourceval is_empty : 'a t -> bool

Test whether the mvar is empty.

Sourceval swap : 'a t -> 'a -> 'a

Wait until the mvar is populated, then put the supplied value in the mvar and return the previous value.

Sourceval modify : 'a t -> ('a -> 'a) -> unit

Wait until the mvar is populated, then use the supplied function to modify its value.

OCaml

Innovation. Community. Security.