Skip to main content

mutex_lock

Function mutex_lock 

pub fn mutex_lock<'a, T>(
    lock: &'a Mutex<T>,
    context: &'static str,
) -> Result<MutexGuard<'a, T>, LaneError>
where T: ?Sized,
Expand description

Locks a Mutex<T>, mapping poisoning to [LaneError::LockPoisoned].

let guard = mutex_lock(&shared, "my-lane.shared")?;