pub unsafe trait RawRwLockTimed: RawRwLock {
type Duration;
type Instant;
// Required methods
fn try_lock_shared_for(
&self,
timeout: Self::Duration,
) -> Option<Self::SharedGuard>;
fn try_lock_shared_until(
&self,
timeout: Self::Instant,
) -> Option<Self::SharedGuard>;
fn try_lock_exclusive_for(
&self,
timeout: Self::Duration,
) -> Option<Self::ExclusiveGuard>;
fn try_lock_exclusive_until(
&self,
timeout: Self::Instant,
) -> Option<Self::ExclusiveGuard>;
}Expand description
Additional methods for RwLocks 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 RawRwLock for
the additional methods provided by this trait.
Required Associated Types§
Required Methods§
Attempts to acquire a shared 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.
Attempts to acquire a shared 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_exclusive_for(
&self,
timeout: Self::Duration,
) -> Option<Self::ExclusiveGuard>
fn try_lock_exclusive_for( &self, timeout: Self::Duration, ) -> Option<Self::ExclusiveGuard>
Attempts to acquire an exclusive 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_exclusive_until(
&self,
timeout: Self::Instant,
) -> Option<Self::ExclusiveGuard>
fn try_lock_exclusive_until( &self, timeout: Self::Instant, ) -> Option<Self::ExclusiveGuard>
Attempts to acquire an exclusive 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".