3 releases
0.1.2 | Oct 8, 2020 |
---|---|
0.1.1 | Apr 14, 2020 |
0.1.0 | Feb 28, 2020 |
#965 in Asynchronous
52,191 downloads per month
Used in 86 crates
(11 directly)
7KB
75 lines
waitgroup
A WaitGroup waits for a collection of task to finish.
Examples
use waitgroup::WaitGroup;
use async_std::task;
async {
let wg = WaitGroup::new();
for _ in 0..100 {
let w = wg.worker();
task::spawn(async move {
// do work
drop(w); // drop w means task finished
};
}
wg.wait().await;
}
License
This project is licensed under Apache License, Version 2.0 (LICENSE ).
lib.rs
:
A WaitGroup waits for a collection of task to finish.
Examples
use waitgroup::WaitGroup;
use async_std::task;
async {
let wg = WaitGroup::new();
for _ in 0..100 {
let w = wg.worker();
task::spawn(async move {
// do work
drop(w); // drop w means task finished
});
}
wg.wait().await;
}
Dependencies
~21KB