pub trait MutexExt<T: ?Sized> {
// Required method
fn lock_adopting(&self) -> MutexGuard<'_, T>;
}Expand description
Locking for a std mutex whose data no holder can leave half-updated.
For such data the poison carries no information, so code that must not panic, such as a drop running during an unwind, can still take the lock.
Required Methods§
Sourcefn lock_adopting(&self) -> MutexGuard<'_, T>
fn lock_adopting(&self) -> MutexGuard<'_, T>
Take the lock, adopting a poisoned one.
The poison only records that some holder panicked, so adopting it is
correct only where no holder can panic midway through an update. A
thread relocking a mutex it already holds may still panic or deadlock,
as under lock.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".