From d047584e86c7235f17084d3115325e4a99a4f761 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 5 Oct 2021 15:55:15 +0200 Subject: [PATCH] time: document `Interval::tick` cancel safety (#4152) --- tokio/src/time/interval.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tokio/src/time/interval.rs b/tokio/src/time/interval.rs index a63e47b6ea6..fe581707185 100644 --- a/tokio/src/time/interval.rs +++ b/tokio/src/time/interval.rs @@ -367,6 +367,11 @@ pub struct Interval { impl Interval { /// Completes when the next instant in the interval has been reached. /// + /// # Cancel safety + /// + /// This method is cancellation safe. If `tick` is used as the branch in a `tokio::select!` and + /// another branch completes first, then no tick has been consumed. + /// /// # Examples /// /// ```