Skip to content

Commit

Permalink
deprecate delay_until, finish up
Browse files Browse the repository at this point in the history
  • Loading branch information
alce committed Sep 9, 2020
1 parent a03397e commit 4a46982
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tokio/src/runtime/task/join.rs
Expand Up @@ -172,12 +172,12 @@ impl<T> JoinHandle<T> {
/// let mut handles = Vec::new();
///
/// handles.push(tokio::spawn(async {
/// time::delay_for(time::Duration::from_secs(10)).await;
/// time::sleep(time::Duration::from_secs(10)).await;
/// true
/// }));
///
/// handles.push(tokio::spawn(async {
/// time::delay_for(time::Duration::from_secs(10)).await;
/// time::sleep(time::Duration::from_secs(10)).await;
/// false
/// }));
///
Expand Down
5 changes: 3 additions & 2 deletions tokio/src/time/delay.rs
Expand Up @@ -20,7 +20,8 @@ pub fn sleep_until(deadline: Instant) -> Delay {
Delay { registration }
}

/// Waits until `deadline` is reached. Alias for [`sleep_until`](sleep_until).
/// use [`sleep_until`](sleep_until)
#[deprecated(note = "delay_until will be removed in Tokio 0.3. Use time::sleep_until")]
pub fn delay_until(deadline: Instant) -> Delay {
sleep_until(deadline)
}
Expand Down Expand Up @@ -60,7 +61,7 @@ pub fn sleep(duration: Duration) -> Delay {
sleep_until(Instant::now() + duration)
}

/// Waits until `duration` has elapsed.
/// use [`sleep`](sleep)
#[deprecated(note = "delay_for will be removed in Tokio 0.3. Use time::sleep")]
pub fn delay_for(duration: Duration) -> Delay {
sleep(duration)
Expand Down

0 comments on commit 4a46982

Please sign in to comment.