Skip to main content

lock

Function lock 

Source
pub fn lock<T: ?Sized>(mutex: &Mutex<T>) -> MutexGuard<'_, T>
Expand description

Take mutex, recovering the guard if a previous holder panicked.

See the module docs: this is only correct because the sections it guards cannot panic, so the recovery branch is unreachable rather than merely tolerated.