Crates.io | rust-waitgroup |
lib.rs | rust-waitgroup |
version | 0.1.0 |
source | src |
created_at | 2024-07-10 03:23:53.994163 |
updated_at | 2024-07-10 03:23:53.994163 |
description | A Golang like WaitGroup |
homepage | https://github.com/nnsgmsone |
repository | https://github.com/nnsgmsone/rust-waitgroup |
max_upload_size | |
id | 1297801 |
size | 39,747 |
rust-waitgroup is a lightweight synchronization primitive for managing concurrency in Rust programs, inspired by the waitgroup from Go.
use rust_waitgroup::WaitGroup;
use std::thread;
let wg = WaitGroup::default();
let n = 10;
for _ in 0..n {
let wg = wg.clone();
wg.add(1);
thread::spawn(move || {
// do some work
wg.done();
});
}
wg.wait();
rust-waitgroup
source code is available under the GPL License.