about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-08-30 06:01:39 -0700
committerGitHub <noreply@github.com>2016-08-30 06:01:39 -0700
commit4473130f4e0a20278225251ea6a0400258b03180 (patch)
treeb4617649f5250d3a948c87bf1283eb66a1c96492 /src/libstd
parent71ee82a8aa0c02fc2c73e84f40bdb55512d10938 (diff)
parent1d2308f2ed2c8708f78c5253661ec957f29b503b (diff)
downloadrust-4473130f4e0a20278225251ea6a0400258b03180.tar.gz
rust-4473130f4e0a20278225251ea6a0400258b03180.zip
Auto merge of #36126 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 16 pull requests

- Successful merges: #35418, #35759, #35862, #35863, #35895, #35962, #35977, #35993, #35997, #36054, #36056, #36060, #36086, #36100, #36103, #36125
- Failed merges: #35771, #35810
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/thread/mod.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index f3e1710f50b..e3f3f9dd6de 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -320,6 +320,24 @@ pub fn spawn<F, T>(f: F) -> JoinHandle<T> where
 }
 
 /// Gets a handle to the thread that invokes it.
+///
+/// #Examples
+///
+/// Getting a handle to the current thread with `thread::current()`:
+///
+/// ```
+/// use std::thread;
+///
+/// let handler = thread::Builder::new()
+///     .name("named thread".into())
+///     .spawn(|| {
+///         let handle = thread::current();
+///         assert_eq!(handle.name(), Some("named thread"));
+///     })
+///     .unwrap();
+///
+/// handler.join().unwrap();
+/// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn current() -> Thread {
     thread_info::current_thread().expect("use of std::thread::current() is not \