Struct wait_group::WaitGroup [] [src]

pub struct WaitGroup(_);

A WaitGroup waits for a collection of threads to finish. Then each of the threads runs and calls Done when finished. At the same time, Wait can be used to block until all threads have finished.

Example

use std::thread;

let wg = wait_group::WaitGroup::new();

for _ in 0..10 {
    wg.add(1);
    let wg2 = wg.clone();
    thread::spawn(move || {
        // do something

        // call done
        wg2.done();
    });
}
// block until all threads have finished
wg.wait();

Methods

impl WaitGroup
[src]

Trait Implementations

impl Clone for WaitGroup
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for WaitGroup
[src]

Formats the value using the given formatter.