module Condition: sig .. end
Lock-base condition.
type t
The type of conditions, constructed from Lock
values.
Operations on conditions should be called only when the lock the
condition was constructed from is held by the current thread.
val await : t -> unit
Waits until either the condition is signal, or the current thread is
interrupted.
Raises Invalid_argument
if the current thread does not hold the
associated lock.
Raises Runtime.Interrupted
if the thread is interrupted.
val await_time : t -> int64 -> TimeUnit.t -> bool
await_time c t u
is similar to await c
, except that the current
thread will at most wait for t
(time value whose unit is u
).
Returns whether the condition was signaled.
Raises Invalid_argument
if the current thread does not hold the
associated lock.
Raises Runtime.Interrupted
if the thread is interrupted.
val await_nanos : t -> int64 -> int64
await_nanos c n
is similar to await c
, except that the current
thread will at most wait for n
nanoseconds. Returns the duration of
the wait, a negative value if the condition was not signaled.
Raises Invalid_argument
if the current thread does not hold the
associated lock.
Raises Runtime.Interrupted
if the thread is interrupted.
val await_uninterruptibly : t -> unit
Similar to await
except that the thread cannot be interrupted.
Raises Invalid_argument
if the current thread does not hold the
associated lock.
val signal : t -> unit
Signals the condition, unblocking one waiting thread.
Raises Invalid_argument
if the current thread does not hold the
associated lock.
val signal_all : t -> unit
Signals the condition, unblocking all waiting threads.
Raises Invalid_argument
if the current thread does not hold the
associated lock.