Skip to main content

RawCondvarTimed

Trait RawCondvarTimed 

Source
pub unsafe trait RawCondvarTimed: RawCondvar
where 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, timeout: &<Self::RawMutex as RawMutexTimed>::Instant, ) -> bool; // Provided method unsafe fn wait_for( &self, mutex: &Self::RawMutex, timeout: &<Self::RawMutex as RawMutexTimed>::Duration, ) -> bool { ... } }
Expand description

Additional methods for RawCondvar which support timeouts.

§Safety

Implementions must ensure that wait_for and wait_until are safe to call, regardless of the specific RawMutex instance provided. If an implementation only supports one instance at a time, waiting may panic.

Required Methods§

Source

fn checked_duration_to_instant( timeout: &<Self::RawMutex as RawMutexTimed>::Duration, ) -> Option<<Self::RawMutex as RawMutexTimed>::Instant>

Attmped to convert the provided Duration into an Instant. Returns None if the provided duration is further into the future than can be represented by an instant.

Source

unsafe fn wait_until( &self, mutex: &Self::RawMutex, timeout: &<Self::RawMutex as RawMutexTimed>::Instant, ) -> bool

Wait until the provided RawMutex is available until the provided timeout is reached.

§Safety

Caller must ensure the provided mutex is locked, and that they are the owner of said lock for the duration of this call.

§Panics

Implementations are permitted to panic if requested to wait on two distinct RawMutexs simultaneously.

Provided Methods§

Source

unsafe fn wait_for( &self, mutex: &Self::RawMutex, timeout: &<Self::RawMutex as RawMutexTimed>::Duration, ) -> bool

Wait until the provided RawMutex is available until the provided timeout is reached.

§Safety

Caller must ensure the provided mutex is locked, and that they are the owner of said lock for the duration of this call.

§Panics

Implementations are permitted to panic if requested to wait on two distinct RawMutexs simultaneously.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§