pub unsafe trait RawCondvarTimed: RawCondvarwhere
Self::RawMutex: RawMutexTimed,{
// Required methods
fn checked_duration_to_instant(
timeout: &<Self::RawMutex as RawMutexTimed>::Duration,
) -> Option<<Self::RawMutex as RawMutexTimed>::Instant>;
unsafe fn wait_until(
&self,
mutex: &Self::RawMutex,
guard: &mut <Self::RawMutex as RawMutex>::Guard,
timeout: &<Self::RawMutex as RawMutexTimed>::Instant,
) -> bool;
// Provided method
unsafe fn wait_for(
&self,
mutex: &Self::RawMutex,
guard: &mut <Self::RawMutex as RawMutex>::Guard,
timeout: &<Self::RawMutex as RawMutexTimed>::Duration,
) -> bool { ... }
}Expand description
Additional methods for condition variables which support timeouts.
§Safety
Implementations must uphold the safety requirements of RawCondvar for
the additional methods provided by this trait.
Required Methods§
Sourcefn checked_duration_to_instant(
timeout: &<Self::RawMutex as RawMutexTimed>::Duration,
) -> Option<<Self::RawMutex as RawMutexTimed>::Instant>
fn checked_duration_to_instant( timeout: &<Self::RawMutex as RawMutexTimed>::Duration, ) -> Option<<Self::RawMutex as RawMutexTimed>::Instant>
Converts a relative timeout into an absolute timeout.
Returns None if the resulting instant cannot be represented.
Sourceunsafe fn wait_until(
&self,
mutex: &Self::RawMutex,
guard: &mut <Self::RawMutex as RawMutex>::Guard,
timeout: &<Self::RawMutex as RawMutexTimed>::Instant,
) -> bool
unsafe fn wait_until( &self, mutex: &Self::RawMutex, guard: &mut <Self::RawMutex as RawMutex>::Guard, timeout: &<Self::RawMutex as RawMutexTimed>::Instant, ) -> bool
Atomically unlocks the mutex and waits for a notification, a spurious wakeup, or the timeout to be reached, then re-locks the mutex before returning.
Returns true if the wait is known to have timed out and false
otherwise. See the RawCondvar implementation’s documentation for
whether a false result guarantees that a notification was received.
A timed-out wait must not return before timeout, but may return later
due to scheduling or platform-specific behavior.
§Safety
The caller must uphold the safety requirements of
RawCondvar::wait.
Provided Methods§
Sourceunsafe fn wait_for(
&self,
mutex: &Self::RawMutex,
guard: &mut <Self::RawMutex as RawMutex>::Guard,
timeout: &<Self::RawMutex as RawMutexTimed>::Duration,
) -> bool
unsafe fn wait_for( &self, mutex: &Self::RawMutex, guard: &mut <Self::RawMutex as RawMutex>::Guard, timeout: &<Self::RawMutex as RawMutexTimed>::Duration, ) -> bool
Atomically unlocks the mutex and waits for a notification, a spurious wakeup, or the timeout to be reached, then re-locks the mutex before returning.
Returns true if the wait is known to have timed out and false
otherwise. See the RawCondvar implementation’s documentation for
whether a false result guarantees that a notification was received.
A timed-out wait must not return before timeout has elapsed, but may
return later due to scheduling or platform-specific behavior.
§Safety
The caller must uphold the safety requirements of
RawCondvar::wait.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".