diff options
| author | Georg Brandl <georg@python.org> | 2016-05-01 22:59:20 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2016-05-02 06:17:51 +0200 |
| commit | eba43fb5c3baaeb543edb6c0abbcf778a176c4a9 (patch) | |
| tree | 12412d0d78c698b34abee66b3d4411c5ef5c7c8b /src/libstd/thread/mod.rs | |
| parent | 2a815a26c8ce70e1aede585827c020d9775a8faf (diff) | |
| download | rust-eba43fb5c3baaeb543edb6c0abbcf778a176c4a9.tar.gz rust-eba43fb5c3baaeb543edb6c0abbcf778a176c4a9.zip | |
std::thread docs: spawn() returns not a Thread anymore
Also move the "Thread type" section down a bit, since it is not so important anymore. Fixes: #33321
Diffstat (limited to 'src/libstd/thread/mod.rs')
| -rw-r--r-- | src/libstd/thread/mod.rs | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index b3549dc1264..2f0dec759b3 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -13,7 +13,8 @@ //! ## The threading model //! //! An executing Rust program consists of a collection of native OS threads, -//! each with their own stack and local state. +//! each with their own stack and local state. Threads can be named, and +//! provide some built-in support for low-level synchronization. //! //! Communication between threads can be done through //! [channels](../../std/sync/mpsc/index.html), Rust's message-passing @@ -37,20 +38,6 @@ //! convenient facilities for automatically waiting for the termination of a //! child thread (i.e., join). //! -//! ## The `Thread` type -//! -//! Threads are represented via the `Thread` type, which you can -//! get in one of two ways: -//! -//! * By spawning a new thread, e.g. using the `thread::spawn` function. -//! * By requesting the current thread, using the `thread::current` function. -//! -//! Threads can be named, and provide some built-in support for low-level -//! synchronization (described below). -//! -//! The `thread::current()` function is available even for threads not spawned -//! by the APIs of this module. -//! //! ## Spawning a thread //! //! A new thread can be spawned using the `thread::spawn` function: @@ -99,6 +86,18 @@ //! }); //! ``` //! +//! ## The `Thread` type +//! +//! Threads are represented via the `Thread` type, which you can get in one of +//! two ways: +//! +//! * By spawning a new thread, e.g. using the `thread::spawn` function, and +//! calling `thread()` on the `JoinHandle`. +//! * By requesting the current thread, using the `thread::current` function. +//! +//! The `thread::current()` function is available even for threads not spawned +//! by the APIs of this module. +//! //! ## Blocking support: park and unpark //! //! Every thread is equipped with some basic low-level blocking support, via the |
