From: Alex Crichton Date: Thu, 15 Jan 2015 22:11:41 +0000 (-0800) Subject: rollup merge of #21075: iKevinY/intro-changes X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=46a490f42bb250c561bcb85eb86f8d07cc6041bc;p=rust.git rollup merge of #21075: iKevinY/intro-changes - Make punctuation/formatting consistent with the changes made to *The Rust Programming Language* in #20782. - Use title casing for "Safety and Speed" section. - Reword some phrases to improve clarity. --- 46a490f42bb250c561bcb85eb86f8d07cc6041bc diff --cc src/doc/intro.md index 8d0ccf6ae3d,f244119f322..d93b680ae6d --- a/src/doc/intro.md +++ b/src/doc/intro.md @@@ -400,15 -400,14 +400,15 @@@ fn main() } ``` -This program creates ten threads, who all print `Hello, world!`. The -`spawn` function takes one argument, a closure, indicated by the -double bars `||`. (The `move` keyword indicates that the closure takes -ownership of any data it uses; we'll have more on the significance of -this shortly.) This closure is executed in a new thread created by -`spawn`. +This program creates ten threads, which all print `Hello, world!`. The `scoped` +function takes one argument, a closure, indicated by the double bars `||`. This +closure is executed in a new thread created by `scoped`. The method is called +`scoped` because it returns a 'join guard', which will automatically join the +child thread when it goes out of scope. Because we `collect` these guards into +a `Vec`, and that vector goes out of scope at the end of our program, our +program will wait for every thread to finish before finishing. - One common form of problem in concurrent programs is a 'data race.' + One common form of problem in concurrent programs is a *data race*. This occurs when two different threads attempt to access the same location in memory in a non-synchronized way, where at least one of them is a write. If one thread is attempting to read, and one thread