Struct bitflags::__core::sync::StaticRwLock
[−]
[src]
pub struct StaticRwLock { // some fields omitted }
Unstable (
static_rwlock
): may be merged with RwLock in the future
Structure representing a statically allocated RwLock.
This structure is intended to be used inside of a static
and will provide
automatic global access as well as lazy initialization. The internal
resources of this RwLock, however, must be manually deallocated.
Examples
#![feature(static_rwlock)] use std::sync::{StaticRwLock, RW_LOCK_INIT}; static LOCK: StaticRwLock = RW_LOCK_INIT; { let _g = LOCK.read().unwrap(); // ... shared read access } { let _g = LOCK.write().unwrap(); // ... exclusive write access } unsafe { LOCK.destroy() } // free all resources