pub fn lock_read<T: Send + Sync + 'static>(
lock: SafeLock<T>,
) -> AsyncOwnedRwLockReadGuard<T>Expand description
Obtain read guard to standard spin lock such that you have a more ergonomic interface to locked data.
It is preferable to use process_read_critical_section when you must process critical logic that is sensitive to time of check time of use security bugs!
ยงExample
use rumtk_core::threading::thread_primitives::SafeLock;
use rumtk_core::threading::threading_functions::{new_lock, lock_read};
let data = 5;
let lock = new_lock(data.clone());
let result = *lock_read(lock);
assert_eq!(result, data, "Failed to access the locked data!");