package miou

  1. Overview
  2. Docs
Composable concurrency primitives for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

miou-0.8.0.tbz
sha256=8cc05f77a23680a52a3008d461afed3b210c29c6cccdacd113232c41bab789fa
sha512=61bc945b1c8c15e65b927cae6837d18988d296f5797012acae5d245cc86be41c6fc3cf88ebe82670181acaaa1ed3f3b0648af63f8c768952bf4d834e5fa92bc2

doc/miou/Miou/Condition/index.html

Module Miou.ConditionSource

Sourcetype t

The type of condition variables.

Sourceval create : unit -> t

create () creates and returns a new condition variable. This condition variable should be associated (in the programmer's mind) with a certain mutex m and with a certain property P of the data structure that is protected by the mutex m.

Sourceval broadcast : t -> unit

broadcast c wakes up all threads waiting on the condition variable c. If there are none, this call has no effect.

It is recommended to call broadcast c inside a critical section, that is, while the mutex m associated with c is locked.

Sourceval signal : t -> unit

signal c wakes up one of the threads waiting on the condition variable c, if there is one. If there is none, this call has no effect.

It is recommended to call signal c inside a critical section, that is, while the mutex m associated with c is locked.

Sourceval wait : t -> Mutex.t -> unit

The call wait c m is permitted only if m is the mutex associated with the condition variable c, and only if m is currently locked. This call atomically unlocks the mutex m and suspends he current thread on the condition variable c. This thread can later be woken up after the condition c has been signaled via signal or broadcast; however, it can also be woken up for no reason. The mutex m is locked again before wait returns. One cannot assume that the property P associated with the condition variable c holds when wait returns; one must explicitly test whether P holds after calling wait.