WAG
Go like sync.WaitGroup implementation in Rust. (sync/async)
| Examples | Docs | Latest Note |
toml
wag = "0.3.0"
How to use,
```rust use wag::WaitGroup;
let wg = WaitGroup::new(); ```
```rust for _ in 0..10 { let w = wg.add();
thread::spawn(move || {
// ...
w.done();
});
}); wg.wait(); // or wg.async_wait().await; ```
```rust for w in wg.adds::<10>() {
thread::spawn(move || {
// ...
w.done();
});
}); wg.wait(); // or wg.async_wait().await; ```
```rust let [w1, w2, w3] = wg.adds();
thread::spawn(move || { // ... w1.done(); });
thread::spawn(move || { // ... w2.done(); });
thread::spawn(move || { // ... w3.done(); });
wg.wait(); // or wg.async_wait().await; ```
```rust wg.addsiter::<10>().enumerate().foreach(|(i, w)| {
thread::spawn(move || {
// ... with i
w.done();
});
}); wg.wait(); // or wg.async_wait().await; ```