/// The entry in the timing wheel. /// /// - `Some` if the timer is registered / pending / woken up / cancelling. /// - `None` if the timer is unregistered.
entry: Option<EntryHandle>,
/// The deadline for the timer.
deadline: Instant,
}
fn with_current_temp_local_context<F, R>(hdl: &SchedulerHandle, f: F) -> R where
F: FnOnce(Option<TempLocalContext<'_>>) -> R,
{ #[cfg(not(feature = "rt"))]
{ let (_, _) = (hdl, f);
panic!("Tokio runtime is not enabled, cannot access the current wheel");
}
let is_same_rt =
context::with_current(|cur_hdl| cur_hdl.is_same_runtime(hdl)).unwrap_or_default();
if !is_same_rt { // We don't want to create the timer in one runtime, // but register it in a different runtime's timer wheel.
f(None)
} else {
context::with_scheduler(|maybe_cx| match maybe_cx {
Some(cx) => cx.with_time_temp_local_context(f),
None => f(None),
})
}
}
}
fn push_from_remote(sched_hdl: &SchedulerHandle, entry_hdl: EntryHandle) { #[cfg(not(feature = "rt"))]
{ let (_, _) = (sched_hdl, entry_hdl);
panic!("Tokio runtime is not enabled, cannot access the current wheel");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.