Skip to content

Commit 34b2303

Browse files
committed
Rollup merge of #33326 - birkenfeld:issue-33321, r=GuillaumeGomez
std::thread docs: spawn() does not return a Thread anymore Also move the "Thread type" section down a bit, since it is not so important anymore. Fixes: #33321
2 parents e04c5c2 + eba43fb commit 34b2303

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/libstd/thread/mod.rs

+14-15
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
//! ## The threading model
1414
//!
1515
//! An executing Rust program consists of a collection of native OS threads,
16-
//! each with their own stack and local state.
16+
//! each with their own stack and local state. Threads can be named, and
17+
//! provide some built-in support for low-level synchronization.
1718
//!
1819
//! Communication between threads can be done through
1920
//! [channels](../../std/sync/mpsc/index.html), Rust's message-passing
@@ -37,20 +38,6 @@
3738
//! convenient facilities for automatically waiting for the termination of a
3839
//! child thread (i.e., join).
3940
//!
40-
//! ## The `Thread` type
41-
//!
42-
//! Threads are represented via the `Thread` type, which you can
43-
//! get in one of two ways:
44-
//!
45-
//! * By spawning a new thread, e.g. using the `thread::spawn` function.
46-
//! * By requesting the current thread, using the `thread::current` function.
47-
//!
48-
//! Threads can be named, and provide some built-in support for low-level
49-
//! synchronization (described below).
50-
//!
51-
//! The `thread::current()` function is available even for threads not spawned
52-
//! by the APIs of this module.
53-
//!
5441
//! ## Spawning a thread
5542
//!
5643
//! A new thread can be spawned using the `thread::spawn` function:
@@ -99,6 +86,18 @@
9986
//! });
10087
//! ```
10188
//!
89+
//! ## The `Thread` type
90+
//!
91+
//! Threads are represented via the `Thread` type, which you can get in one of
92+
//! two ways:
93+
//!
94+
//! * By spawning a new thread, e.g. using the `thread::spawn` function, and
95+
//! calling `thread()` on the `JoinHandle`.
96+
//! * By requesting the current thread, using the `thread::current` function.
97+
//!
98+
//! The `thread::current()` function is available even for threads not spawned
99+
//! by the APIs of this module.
100+
//!
102101
//! ## Blocking support: park and unpark
103102
//!
104103
//! Every thread is equipped with some basic low-level blocking support, via the

0 commit comments

Comments
 (0)