diff options
author | Juan Alvarez <j@yabit.io> | 2020-10-08 22:35:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-08 20:35:12 -0700 |
commit | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 (patch) | |
tree | 4a6b64401944b62ffa872147e5738eb28e70d4ec /tokio/src/time/driver | |
parent | b704c53b9cc76eaf8c9c6585f8444c4515d27728 (diff) |
time: rename `Delay` future to `Sleep` (#2932)
Diffstat (limited to 'tokio/src/time/driver')
-rw-r--r-- | tokio/src/time/driver/entry.rs | 10 | ||||
-rw-r--r-- | tokio/src/time/driver/mod.rs | 18 |
2 files changed, 14 insertions, 14 deletions
diff --git a/tokio/src/time/driver/entry.rs b/tokio/src/time/driver/entry.rs index 20f8e1c6..20a3a8c5 100644 --- a/tokio/src/time/driver/entry.rs +++ b/tokio/src/time/driver/entry.rs @@ -11,7 +11,7 @@ use std::sync::{Arc, Weak}; use std::task::{self, Poll}; use std::u64; -/// Internal state shared between a `Delay` instance and the timer. +/// Internal state shared between a `Sleep` instance and the timer. /// /// This struct is used as a node in two intrusive data structures: /// @@ -28,7 +28,7 @@ pub(crate) struct Entry { time: CachePadded<UnsafeCell<Time>>, /// Timer internals. Using a weak pointer allows the timer to shutdown - /// without all `Delay` instances having completed. + /// without all `Sleep` instances having completed. /// /// When empty, it means that the entry has not yet been linked with a /// timer instance. @@ -69,8 +69,8 @@ pub(crate) struct Entry { /// When the entry expires, relative to the `start` of the timer /// (Inner::start). This is only used by the timer. /// - /// A `Delay` instance can be reset to a different deadline by the thread - /// that owns the `Delay` instance. In this case, the timer thread will not + /// A `Sleep` instance can be reset to a different deadline by the thread + /// that owns the `Sleep` instance. In this case, the timer thread will not /// immediately know that this has happened. The timer thread must know the /// last deadline that it saw as it uses this value to locate the entry in /// its wheel. @@ -94,7 +94,7 @@ pub(crate) struct Entry { pub(crate) prev_stack: UnsafeCell<*const Entry>, } -/// Stores the info for `Delay`. +/// Stores the info for `Sleep`. #[derive(Debug)] pub(crate) struct Time { pub(crate) deadline: Instant, diff --git a/tokio/src/time/driver/mod.rs b/tokio/src/time/driver/mod.rs index 5ece7c72..94e905b4 100644 --- a/tokio/src/time/driver/mod.rs +++ b/tokio/src/time/driver/mod.rs @@ -20,12 +20,12 @@ use std::sync::Arc; use std::usize; use std::{cmp, fmt}; -/// Time implementation that drives [`Delay`][delay], [`Interval`][interval], and [`Timeout`][timeout]. +/// Time implementation that drives [`Sleep`][sleep], [`Interval`][interval], and [`Timeout`][timeout]. /// /// A `Driver` instance tracks the state necessary for managing time and -/// notifying the [`Delay`][delay] instances once their deadlines are reached. +/// notifying the [`Sleep`][sleep] instances once their deadlines are reached. /// -/// It is expected that a single instance manages many individual [`Delay`][delay] +/// It is expected that a single instance manages many individual [`Sleep`][sleep] /// instances. The `Driver` implementation is thread-safe and, as such, is able /// to handle callers from across threads. /// @@ -36,9 +36,9 @@ use std::{cmp, fmt}; /// The driver has a resolution of one millisecond. Any unit of time that falls /// between milliseconds are rounded up to the next millisecond. /// -/// When an instance is dropped, any outstanding [`Delay`][delay] instance that has not +/// When an instance is dropped, any outstanding [`Sleep`][sleep] instance that has not /// elapsed will be notified with an error. At this point, calling `poll` on the -/// [`Delay`][delay] instance will result in panic. +/// [`Sleep`][sleep] instance will result in panic. /// /// # Implementation /// @@ -65,14 +65,14 @@ use std::{cmp, fmt}; /// * Level 5: 64 x ~12 day slots. /// /// When the timer processes entries at level zero, it will notify all the -/// `Delay` instances as their deadlines have been reached. For all higher +/// `Sleep` instances as their deadlines have been reached. For all higher /// levels, all entries will be redistributed across the wheel at the next level -/// down. Eventually, as time progresses, entries with [`Delay`][delay] instances will +/// down. Eventually, as time progresses, entries with [`Sleep`][sleep] instances will /// either be canceled (dropped) or their associated entries will reach level /// zero and be notified. /// /// [paper]: http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf -/// [delay]: crate::time::Delay +/// [sleep]: crate::time::Sleep /// [timeout]: crate::time::Timeout /// [interval]: crate::time::Interval #[derive(Debug)] @@ -138,7 +138,7 @@ where /// Returns a handle to the timer. /// - /// The `Handle` is how `Delay` instances are created. The `Delay` instances + /// The `Handle` is how `Sleep` instances are created. The `Sleep` instances /// can either be created directly or the `Handle` instance can be passed to /// `with_default`, setting the timer as the default timer for the execution /// context. |