[src]

Module sync::mutex

A proper mutex implementation regardless of the "flavor of task" which is acquiring the lock.

Guard

An RAII implementation of a "scoped lock" of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.

Mutex

A mutual exclusion primitive useful for protecting shared data

StaticMutex

The static mutex type is provided to allow for static allocation of mutexes.

pub static GREEN_BLOCKED: uint = 1 << 1  
pub static LOCKED: uint = 1 << 0  
pub static MUTEX_INIT: StaticMutex =
StaticMutex {
    lock: mutex::NATIVE_MUTEX_INIT,
    state: atomics::INIT_ATOMIC_UINT,
    flavor: Unsafe { value: Unlocked, marker1: marker::InvariantType },
    green_blocker: Unsafe { value: 0, marker1: marker::InvariantType },
    native_blocker: Unsafe { value: 0, marker1: marker::InvariantType },
    green_cnt: atomics::INIT_ATOMIC_UINT,
    q: q::Queue {
        head: atomics::INIT_ATOMIC_UINT,
        tail: Unsafe {
            value: 0 as *mut q::Node,
            marker1: marker::InvariantType,
        },
        stub: q::DummyNode {
            next: atomics::INIT_ATOMIC_UINT,
        }
    }
}

Static initialization of a mutex. This constant can be used to initialize other mutex constants.

 
pub static NATIVE_BLOCKED: uint = 1 << 2