pub trait Park {
    type Unpark: Unpark;
    type Error;
    fn unpark(&self) -> Self::Unpark;
fn park(&mut self) -> Result<(), Self::Error>;
fn park_timeout(&mut self, duration: Duration) -> Result<(), Self::Error>; }
Expand description

Block the current thread.

See module documentation for more details.

Associated Types

Unpark handle type for the Park implementation.

Error returned by park

Required methods

Get a new Unpark handle associated with this Park instance.

Block the current thread unless or until the token is available.

A call to park does not guarantee that the thread will remain blocked forever, and callers should be prepared for this possibility. This function may wakeup spuriously for any reason.

See module documentation for more details.

Panics

This function should not panic, but ultimately, panics are left as an implementation detail. Refer to the documentation for the specific Park implementation

Park the current thread for at most duration.

This function is the same as park but allows specifying a maximum time to block the thread for.

Same as park, there is no guarantee that the thread will remain blocked for any amount of time. Spurious wakeups are permitted for any reason.

See module documentation for more details.

Panics

This function should not panic, but ultimately, panics are left as an implementation detail. Refer to the documentation for the specific Park implementation

Implementors