Trait lock_api::RawMutex

source ·
pub unsafe trait RawMutex {
    type GuardMarker;

    const INIT: Self;

    fn lock(&self);
    fn try_lock(&self) -> bool;
    fn unlock(&self);
}
Expand description

Basic operations for a mutex.

Types implementing this trait can be used by Mutex to form a safe and fully-functioning mutex type.

Safety

Implementations of this trait must ensure that the mutex is actually exclusive: a lock can’t be acquired while the mutex is already locked.

Required Associated Types§

Marker type which determines whether a lock guard should be Send. Use one of the GuardSend or GuardNoSend helper types here.

Required Associated Constants§

Initial value for an unlocked mutex.

Required Methods§

Acquires this mutex, blocking the current thread until it is able to do so.

Attempts to acquire this mutex without blocking.

Unlocks this mutex.

Implementors§