sync-wait-group

Crates.iosync-wait-group
lib.rssync-wait-group
version0.1.1
sourcesrc
created_at2022-04-27 11:59:41.516191
updated_at2022-07-07 08:21:26.082876
descriptionWait group for synchronizing the beginning or end of some computation.
homepagehttps://github.com/davidli2010/sync-wait-group
repositoryhttps://github.com/davidli2010/sync-wait-group.git
max_upload_size
id576009
size19,250
David  Li (davidli2010)

documentation

https://docs.rs/sync-wait-group/

README

sync-wait-group

Crate API

License: Apache OR License: MIT

Wait group for synchronizing the beginning or end of some computation.

This crate is duplicated WaitGroup from crossbeam_utils::sync::WaitGroup, but use parking_lot::{Mutex, Condvar} instead of std::sync::{Mutex, Condvar}.

Example

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();

Rust Version

This version of sync-wait-group requires Rust 1.56 or later.

License

Dual-licensed to be compatible with the Rust project.

Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in sync-wait-group by you, shall be licensed as Apache-2.0 and MIT, without any additional terms or conditions.

Commit count: 4

cargo fmt