lock_api

Trait RawMutexTimed

Source
pub unsafe trait RawMutexTimed: RawMutex {
    type Duration;
    type Instant;

    // Required methods
    fn try_lock_for(&self, timeout: Self::Duration) -> bool;
    fn try_lock_until(&self, timeout: Self::Instant) -> bool;
}
Expand description

Additional methods for mutexes which support locking with timeouts.

The Duration and Instant types are specified as associated types so that this trait is usable even in no_std environments.

Required Associated Types§

Source

type Duration

Duration type used for try_lock_for.

Source

type Instant

Instant type used for try_lock_until.

Required Methods§

Source

fn try_lock_for(&self, timeout: Self::Duration) -> bool

Attempts to acquire this lock until a timeout is reached.

Source

fn try_lock_until(&self, timeout: Self::Instant) -> bool

Attempts to acquire this lock until a timeout is reached.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§