about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-03-28 12:52:03 -0700
committerbors <bors@rust-lang.org>2016-03-28 12:52:03 -0700
commit221c940bf34887bb3f1900b757f8245ad23e8ef4 (patch)
tree7712d6dfd8920c7648e5d7583cc6177e0935a20d /src/libstd/sync
parent1f131fbe7799b9c3d4a775798b90760f7c11ef33 (diff)
parent9eea1d7494277fdf8dfddf93fdfdc27130c31971 (diff)
downloadrust-221c940bf34887bb3f1900b757f8245ad23e8ef4.tar.gz
rust-221c940bf34887bb3f1900b757f8245ad23e8ef4.zip
Auto merge of #32561 - steveklabnik:rollup, r=steveklabnik
Rollup of 7 pull requests

- Successful merges: #32177, #32235, #32472, #32504, #32507, #32509, #32534
- Failed merges:
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/barrier.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs
index 4df6ca5f0b8..b543240c15a 100644
--- a/src/libstd/sync/barrier.rs
+++ b/src/libstd/sync/barrier.rs
@@ -17,16 +17,21 @@ use sync::{Mutex, Condvar};
 /// use std::sync::{Arc, Barrier};
 /// use std::thread;
 ///
+/// let mut handles = Vec::with_capacity(10);
 /// let barrier = Arc::new(Barrier::new(10));
 /// for _ in 0..10 {
 ///     let c = barrier.clone();
 ///     // The same messages will be printed together.
 ///     // You will NOT see any interleaving.
-///     thread::spawn(move|| {
+///     handles.push(thread::spawn(move|| {
 ///         println!("before wait");
 ///         c.wait();
 ///         println!("after wait");
-///     });
+///     }));
+/// }
+/// // Wait for other threads to finish.
+/// for handle in handles {
+///     handle.join().unwrap();
 /// }
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]