Struct sync::Condvar
pub struct Condvar<'a> { // some fields omitted }
A condition variable, a mechanism for unlock-and-descheduling and signaling, for use with the lock types.
Methods
impl<'a> Condvar<'a>
fn wait(&self)
Atomically exit the associated lock and block until a signal is sent.
wait() is equivalent to wait_on(0).
Failure
A task which is killed 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)
Atomically exit the associated lock and block on a specified condvar until a signal is sent on that same condvar.
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.
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
Wake up a blocked task on a specified condvar (as sync::cond.signal_on). Returns false if there was no blocked task.
fn broadcast(&self) -> uint
Wake up all blocked tasks. Returns the number of tasks woken.
fn broadcast_on(&self, condvar_id: uint) -> uint
Wake up all blocked tasks on a specified condvar (as sync::cond.broadcast_on). Returns the number of tasks woken.