pub struct Parked<'a> { /* private fields */ }
Expand description
Proof of parking.
Park functions return Parked
objects as a proof of having called Park::race_free()
. This
is necessary because Park::race_free()
updates executor state and must always be run.
Parked
can be used by park functions to determine whether blocking or sleeping is
permissible. See Park
documentation for the correct parking protocol.
Implementations§
Source§impl Parked<'_>
impl Parked<'_>
Sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Check whether useful work is certainly not possible until an event is raised.
Unlike the calling of the park function, this is not an optimistic operation.
Its result will be exact as long as the Park
protocol is correctly followed.
A return value of false
prohibits the park function from sleeping at all:
it should yield control to the executor immediately. A return value of true
is a strong hint to sleep, block, or otherwise take over control flow until
some unspecified condition, ideally until an event is raised.
See also the Park
protocol.