Struct bitflags::__core::sync::StaticMutex
[−]
[src]
pub struct StaticMutex {
// some fields omitted
}Unstable (
static_mutex): may be merged with Mutex in the future
The static mutex type is provided to allow for static allocation of mutexes.
Note that this is a separate type because using a Mutex correctly means that
it needs to have a destructor run. In Rust, statics are not allowed to have
destructors. As a result, a StaticMutex has one extra method when compared
to a Mutex, a destroy method. This method is unsafe to call, and
documentation can be found directly on the method.
Examples
#![feature(static_mutex)] use std::sync::{StaticMutex, MUTEX_INIT}; static LOCK: StaticMutex = MUTEX_INIT; { let _g = LOCK.lock().unwrap(); // do some productive work } // lock is unlocked here.