|
13 | 13 | //! ## The threading model |
14 | 14 | //! |
15 | 15 | //! 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. |
17 | 18 | //! |
18 | 19 | //! Communication between threads can be done through |
19 | 20 | //! [channels](../../std/sync/mpsc/index.html), Rust's message-passing |
|
37 | 38 | //! convenient facilities for automatically waiting for the termination of a |
38 | 39 | //! child thread (i.e., join). |
39 | 40 | //! |
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 | | -//! |
54 | 41 | //! ## Spawning a thread |
55 | 42 | //! |
56 | 43 | //! A new thread can be spawned using the `thread::spawn` function: |
|
99 | 86 | //! }); |
100 | 87 | //! ``` |
101 | 88 | //! |
| 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 | +//! |
102 | 101 | //! ## Blocking support: park and unpark |
103 | 102 | //! |
104 | 103 | //! Every thread is equipped with some basic low-level blocking support, via the |
|
0 commit comments