Struct sync::raw::Mutex[src]
pub struct Mutex {
// some fields omitted
}A blocking, bounded-waiting, mutual exclusion lock with an associated FIFO condition variable.
Failure
A task which fails while holding a mutex will unlock the mutex as it unwinds.
Methods
impl Mutex
fn new() -> Mutex
Create a new mutex, with one associated condvar.
fn new_with_condvars(num_condvars: uint) -> Mutex
Create a new mutex, with a specified number of associated condvars. This will allow calling wait_on/signal_on/broadcast_on with condvar IDs between 0 and num_condvars-1. (If num_condvars is 0, lock_cond will be allowed but any operations on the condvar will fail.)
fn lock<'a>(&'a self) -> MutexGuard<'a>
Acquires ownership of this mutex, returning an RAII guard which will unlock the mutex when dropped. The associated condition variable can also be accessed through the returned guard.