Struct sync::raw::Condvar[src]

pub struct Condvar<'a> {
    // some fields omitted
}

A mechanism for atomic-unlock-and-deschedule blocking and signalling.

Methods

impl<'a> Condvar<'a>

fn wait(&self)

Atomically drop the associated lock, and block until a signal is sent.

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)

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.