Skip to main content

lock_reservation

Function lock_reservation 

Source
pub(crate) fn lock_reservation(
    reservation: &Mutex<Option<Box<dyn MemoryReservation>>>,
) -> MutexGuard<'_, Option<Box<dyn MemoryReservation>>>
Expand description

Lock a memory reservation, recovering from a poisoned lock.

A poisoned lock only means that some other thread panicked. The reservation it guards is plain size accounting, so there is no broken invariant to protect, and recovering it is always preferable to panicking.