Skip to content

Commit

Permalink
Auto merge of #33665 - golddranks:thread-park-add-big-picture-explana…
Browse files Browse the repository at this point in the history
…tion, r=aturon

Added a big-picture explanation for thread::park() & co.

As I said in https://www.reddit.com/r/rust/comments/4ihvv1/hey_rust_programmers_got_a_question_ask_here/d372s4i, the current explanation of the `park()` and `unpark()` is a bit unclear. It says that they're used for blocking, but then it goes on explaining the semantics in detail, leaving the bigger picture a bit unclear.

I added a short high-level explanation that explains how the functions are used. I also exposed the full paths (`thread::park()` and `thread::Thread::unpark()`), because `unpark()`, being a method, is not directly visible at the module level.
  • Loading branch information
bors committed May 17, 2016
2 parents 30422de + 20b9129 commit 0667ae9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libstd/thread/mod.rs
Expand Up @@ -101,7 +101,9 @@
//! ## Blocking support: park and unpark
//!
//! Every thread is equipped with some basic low-level blocking support, via the
//! `park` and `unpark` functions.
//! `thread::park()` function and `thread::Thread::unpark()` method. `park()`
//! blocks the current thread, which can then be resumed from another thread by
//! calling the `unpark()` method on the blocked thread's handle.
//!
//! Conceptually, each `Thread` handle has an associated token, which is
//! initially not present:
Expand Down

0 comments on commit 0667ae9

Please sign in to comment.