Crate sync_wait_group

Source
Expand description

Enables threads to synchronize the beginning or end of some computation.

§Examples

use sync_wait_group::WaitGroup;
use std::thread;

// Create a new wait group.
let wg = WaitGroup::new();

for _ in 0..4 {
    // Create another reference to the wait group.
    let wg = wg.clone();

    thread::spawn(move || {
        // Do some work.

        // Drop the reference to the wait group.
        drop(wg);
    });
}

// Block until all threads have finished their work.
wg.wait();

Structs§

WaitGroup
Enables threads to synchronize the beginning or end of some computation.