about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-06-28 07:48:56 -0700
committerGitHub <noreply@github.com>2016-06-28 07:48:56 -0700
commit59152a45af3688b53e677ea2362339643499c1a4 (patch)
tree451a1988dffa6bfa09c0a2d7b84f78ef44125f15 /src/libstd/thread
parentea0dc9297283daff6486807f43e190b4eb561412 (diff)
parentdd56a6ad0845b76509c4f8967e8ca476471ab7e0 (diff)
downloadrust-59152a45af3688b53e677ea2362339643499c1a4.tar.gz
rust-59152a45af3688b53e677ea2362339643499c1a4.zip
Auto merge of #34525 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 13 pull requests

- Successful merges: #34080, #34287, #34328, #34406, #34415, #34442, #34462, #34471, #34475, #34479, #34517, #34518, #34524
- Failed merges: #33951
Diffstat (limited to 'src/libstd/thread')
-rw-r--r--src/libstd/thread/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 3bee878de35..e9736fea7b3 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -394,6 +394,19 @@ pub fn sleep_ms(ms: u32) {
 /// signal being received or a spurious wakeup. Platforms which do not support
 /// nanosecond precision for sleeping will have `dur` rounded up to the nearest
 /// granularity of time they can sleep for.
+///
+/// # Examples
+///
+/// ```rust,no_run
+/// use std::{thread, time};
+///
+/// let ten_millis = time::Duration::from_millis(10);
+/// let now = time::Instant::now();
+///
+/// thread::sleep(ten_millis);
+///
+/// assert!(now.elapsed() >= ten_millis);
+/// ```
 #[stable(feature = "thread_sleep", since = "1.4.0")]
 pub fn sleep(dur: Duration) {
     imp::Thread::sleep(dur)