[−][src]Module ruspiro_lock::datalock
Data Lock
Enable exclusive access to data guarded by a cross core atomic lock
Example
static DATA: DataLock<u32> = DataLock::new(0); fn main() { if let Some(mut data) = DATA.try_lock() { *data = 20; } // once the data goes ot of scope the lock will be released if let Some(data) = DATA.try_lock() { println!("data: {}", *data); // another lock should fail inside this scope assert_eq!(DATA.try_lock(), None); } }
Structs
DataLock | An exclusive access lock around the given data |
TryDataLock | Result of trying to access the data using |