diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-06-25 14:16:20 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-06-25 18:16:40 +0530 |
| commit | 80b352c89272a9ab48b32e9700da2f35246af820 (patch) | |
| tree | cf4aa02ce931a5f9bcc095cabf075c1282ab172a /src/libstd/thread | |
| parent | bb12a5305999824a04f7d01f1e5845f7582a21ca (diff) | |
| parent | 5e9b75e2dd440a5df2c7d90f88b2660c7581d964 (diff) | |
| download | rust-80b352c89272a9ab48b32e9700da2f35246af820.tar.gz rust-80b352c89272a9ab48b32e9700da2f35246af820.zip | |
Rollup merge of #34438 - frewsxcv:joinhandle, r=GuillaumeGomez
Indicate how the `JoinHandle` struct is created. None
Diffstat (limited to 'src/libstd/thread')
| -rw-r--r-- | src/libstd/thread/mod.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index d83d45518e4..e68e525b4ac 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -610,6 +610,36 @@ impl<T> JoinInner<T> { /// Due to platform restrictions, it is not possible to `Clone` this /// handle: the ability to join a child thread is a uniquely-owned /// permission. +/// +/// This `struct` is created by the [`thread::spawn`] function and the +/// [`thread::Builder::spawn`] method. +/// +/// # Examples +/// +/// Creation from [`thread::spawn`]: +/// +/// ```rust +/// use std::thread; +/// +/// let join_handle: thread::JoinHandle<_> = thread::spawn(|| { +/// // some work here +/// }); +/// ``` +/// +/// Creation from [`thread::Builder::spawn`]: +/// +/// ```rust +/// use std::thread; +/// +/// let builder = thread::Builder::new(); +/// +/// let join_handle: thread::JoinHandle<_> = builder.spawn(|| { +/// // some work here +/// }).unwrap(); +/// ``` +/// +/// [`thread::spawn`]: fn.spawn.html +/// [`thread::Builder::spawn`]: struct.Builder.html#method.spawn #[stable(feature = "rust1", since = "1.0.0")] pub struct JoinHandle<T>(JoinInner<T>); |
