Struct sync::Barrier
pub struct Barrier { // some fields omitted }
A barrier enables multiple tasks to synchronize the beginning of some computation.
use sync::{Arc, Barrier}; let barrier = Arc::new(Barrier::new(10)); for _ in range(0, 10) { let c = barrier.clone(); // The same messages will be printed together. // You will NOT see any interleaving. spawn(proc() { println!("before wait"); c.wait(); println!("after wait"); }); }