pub struct Condvar<'self> { priv sem: &'self Sem<~[WaitQueue]>, priv order: ReacquireOrderLock<'self>, priv token: std::util::NonCopyable, }
A mechanism for atomic-unlock-and-deschedule blocking and signalling.
impl<'self> Condvar<'self>
fn wait(&self)
Atomically drop the associated lock, and block until a signal is sent.
A task which is killed (i.e., by linked failure with another task) while waiting on a condition variable will wake up, fail, and unlock the associated lock as it unwinds.
fn wait_on(&self, condvar_id: uint)
As wait(), but can specify which of multiple condition variables to wait on. Only a signal_on() or broadcast_on() with the same condvar_id will wake this thread.
The associated lock must have been initialised with an appropriate number of condvars. The condvar_id must be between 0 and num_condvars-1 or else this call will fail.
wait() is equivalent to wait_on(0).
fn signal(&self) -> bool
Wake up a blocked task. Returns false if there was no blocked task.
fn signal_on(&self, condvar_id: uint) -> bool
As signal, but with a specified condvar_id. See wait_on.
fn broadcast(&self) -> uint
Wake up all blocked tasks. Returns the number of tasks woken.
fn broadcast_on(&self, condvar_id: uint) -> uint
As broadcast, but with a specified condvar_id. See wait_on.
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
(or str
), enum
,
trait
, typedef
(or
tdef
).