pub struct WaitEpoch(/* private fields */);Expand description
Identifies one specific park of a flow in its mailbox.
§Why a timeout needs a token
Cancellation of a ReceiveTimeout deadline is lazy: the timer thread
does not remove its entry when a hop wakes the receiver early, it just
finds nobody parked when it eventually fires. That reasoning only holds
if the flow never parks again before the old deadline — and in a
receive loop it always does:
t=0 ReceiveTimeout(r5, 100ms) -> park A, timer(100ms) armed
t=20 hop arrives -> handoff, park A over, flow runs
t=30 Receive(r7) -> park B (no timeout)
t=100 timer for park A fires -> takes park B!
writes Unit into r5, not r7That is a spurious wake and a write to the previous wait’s register.
So Mailbox::park returns the epoch of the park it installed, the
timer carries it, and Mailbox::take_parked_at only hands the flow
over while that epoch is still current.
There is no public constructor: an epoch can only come from parking, so a timeout cannot present one for a wait that never happened.
Implementations§
Trait Implementations§
impl Copy for WaitEpoch
impl Eq for WaitEpoch
impl StructuralPartialEq for WaitEpoch
Auto Trait Implementations§
impl Freeze for WaitEpoch
impl RefUnwindSafe for WaitEpoch
impl Send for WaitEpoch
impl Sync for WaitEpoch
impl Unpin for WaitEpoch
impl UnsafeUnpin for WaitEpoch
impl UnwindSafe for WaitEpoch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more