Module Lwt_condition
Conditions
type 'a tCondition variable type. The type parameter denotes the type of value propagated from notifier to waiter.
val create : unit -> 'a tcreate ()creates a new condition variable.
val wait : ?mutex:Lwt_mutex.t -> 'a t -> 'a Lwt.twait mutex condvarwill cause the current thread to block, awaiting notification for a condition variable,condvar. If provided, themutexmust have been previously locked (within the scope ofLwt_mutex.with_lock, for example) and is temporarily unlocked until the condition is notified. Upon notification,mutexis re-locked beforewaitreturns and the thread's activity is resumed. When the awaited condition is notified, the value parameter passed tosignalis returned.
val signal : 'a t -> 'a -> unitsignal condvar valuenotifies that a condition is ready. A single waiting thread will be awoken and will receive the notification value which will be returned fromwait. Note that condition notification is not "sticky", i.e. if there is no waiter whensignalis called, the notification will be missed and the value discarded.
val broadcast : 'a t -> 'a -> unitbroadcast condvar valuenotifies all waiting threads. Each will be awoken in turn and will receive the same notification value.
val broadcast_exn : 'a t -> exn -> unitbroadcast_exn condvar exnfails all waiting threads with exceptionexn.- since
- 2.6.0