Stdlib.Condition(3)
π NAME π
Stdlib.Condition - no description. That's literally it, bestie: no description ππ
π¦ Module π¦
Okay so this page is from the OCaml library, and the module is:
Module Stdlib.Condition
β¨ Documentation β¨
The docs are under Module Condition, and it's:
Module Condition
: (module Stdlib__Condition)
So here's the whole vibe, function by function π
type tβ the type of condition variables. πval 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 mutexmand with a certain propertyPof the data structure that is protected by the mutexm. β¨val wait : t -> Mutex.t -> unitβ The callwait c mis permitted only ifmis the mutex associated with the condition variablec, and only ifmis currently locked. This call atomically unlocks the mutexmand suspends the current thread on the condition variablec. This thread can later be woken up after the condition variablechas been signaled viaCondition.signalorCondition.broadcast; however, it can also be woken up for no reason. The mutexmis locked again beforewaitreturns. One cannot assume that the propertyPassociated with the condition variablecholds whenwaitreturns; one must explicitly test whetherPholds after callingwait. π
Thewaitcaveat is the main-character plot twist: whenwaitreturns, do not assumePholds β explicitly test whetherPholds after callingwait. π«Ά
val signal : t -> unitβsignal cwakes up one of the threads waiting on the condition variablec, if there is one. If there is none, this call has no effect. It is recommended to callsignal cinside a critical section, that is, while the mutexmassociated withcis locked. π₯val broadcast : t -> unitβbroadcast cwakes up all threads waiting on the condition variablec. If there are none, this call has no effect. It is recommended to callbroadcast cinside a critical section, that is, while the mutexmassociated withcis locked. π
And that's the whole page, bestie π
Served up by OCamldoc, dated 2026-06-22, for Stdlib.Condition(3) β bye, love u, read ur mutex docs ππ
π¦ where this page comes from
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms