pub unsafe trait RawMutexTimed: RawMutex {
type Duration;
type Instant;
// Required methods
fn try_lock_for(&self, timeout: Self::Duration) -> Option<Self::Guard>;
fn try_lock_until(&self, timeout: Self::Instant) -> Option<Self::Guard>;
}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.
§Safety
Implementations must uphold the safety requirements of RawMutex for
the additional methods provided by this trait.
Required Associated Types§
Required Methods§
Sourcefn try_lock_for(&self, timeout: Self::Duration) -> Option<Self::Guard>
fn try_lock_for(&self, timeout: Self::Duration) -> Option<Self::Guard>
Attempts to acquire this lock until a timeout is reached.
A successful operation may return early. An unsuccessful operation must not return before the timeout, but may return later due to scheduling or platform-specific behavior.
Sourcefn try_lock_until(&self, timeout: Self::Instant) -> Option<Self::Guard>
fn try_lock_until(&self, timeout: Self::Instant) -> Option<Self::Guard>
Attempts to acquire this lock until a timeout is reached.
A successful operation may return early. An unsuccessful operation must not return before the timeout, but may return later due to scheduling or platform-specific behavior.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".