diff options
author | Juan Alvarez <j@yabit.io> | 2020-10-01 02:24:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 09:24:33 +0200 |
commit | 53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5 (patch) | |
tree | 66f0b4c089729616b57bbb69b0a6351b45a0c898 /tokio/src/runtime | |
parent | 971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40 (diff) |
time: introduce `sleep` and `sleep_until` functions (#2826)
Diffstat (limited to 'tokio/src/runtime')
-rw-r--r-- | tokio/src/runtime/task/join.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tokio/src/runtime/task/join.rs b/tokio/src/runtime/task/join.rs index ae776509..9b73353d 100644 --- a/tokio/src/runtime/task/join.rs +++ b/tokio/src/runtime/task/join.rs @@ -121,7 +121,7 @@ doc_rt_core! { /// let original_task = task::spawn(async { /// let _detached_task = task::spawn(async { /// // Here we sleep to make sure that the first task returns before. - /// time::delay_for(Duration::from_millis(10)).await; + /// time::sleep(Duration::from_millis(10)).await; /// // This will be called, even though the JoinHandle is dropped. /// println!("♫ Still alive ♫"); /// }); @@ -133,7 +133,7 @@ doc_rt_core! { /// // We make sure that the new task has time to run, before the main /// // task returns. /// - /// time::delay_for(Duration::from_millis(1000)).await; + /// time::sleep(Duration::from_millis(1000)).await; /// # } /// ``` /// @@ -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 /// })); /// |