Module Luv.Condition

Condition variables.

See Conditions in libuv.

type t

Binds uv_cond_t.

val init : unit -> (t, Error.t) Stdlib.result

Allocates and initializes a condition variable.

Binds uv_cond_init. See pthread_cond_init(3p).

val destroy : t -> unit

Cleans up a condition variable.

Binds uv_cond_destroy. See pthread_cond_destroy(3p).

val signal : t -> unit

Signals a condition variable.

Binds uv_cond_signal. See pthread_cond_signal(3p).

val broadcast : t -> unit

Signals a condition variable, waking all waiters.

Binds uv_cond_broadcast. See pthread_cond_broadcast(3p).

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

Waits on a condition variable.

Binds uv_cond_wait. See pthread_cond_wait(3p).

val timedwait : t -> Mutex.t -> int -> (unit, Error.t) Stdlib.result

Like Luv.Condition.wait, but with a timeout.

Binds uv_cond_timedwait. See pthread_cond_timedwait(3p).

The timeout is given in nanoseconds.