Skip to main content

MutexGuard

Trait MutexGuard 

Source
pub trait MutexGuard: Sealed + AsRawUnderlying<Underlying = pthread_mutex_t> {
    // Required method
    fn mark_consistent(&mut self) -> Result<(), MutexLockError>;
}
Expand description

Implemented by every guard in this module.

It exists so that a condition variable can be handed any of them without caring which lock operation produced it. This trait is sealed.

Required Methods§

Source

fn mark_consistent(&mut self) -> Result<(), MutexLockError>

Available on FreeBSD or Linux only.

Arranges for the data protected by the mutex to be marked consistent again. Which of the two moments that happens at depends on the guard: StandardGuard does it at once, while an indeterminate guard records the request and acts on it when it is dropped.

This is only meaningful for a robust mutex whose previous owner died while holding the lock. Every other mutex reports MutexLockError::Invalid.

§Errors

See MutexLockError

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl MutexGuard for IndeterminateGuard<'_>

Available on FreeBSD or Linux only.
Source§

impl MutexGuard for RobustGuardContainer<'_>

Available on FreeBSD or Linux only.
Source§

impl MutexGuard for StandardGuard<'_>