Crates.io | waitgroup |
lib.rs | waitgroup |
version | 0.1.2 |
source | src |
created_at | 2020-02-28 16:04:47.321076 |
updated_at | 2020-10-08 09:19:59.803882 |
description | Async waitgroup for a collection of task to finish |
homepage | https://github.com/laizy/waitgroup-rs |
repository | https://github.com/laizy/waitgroup-rs |
max_upload_size | |
id | 213570 |
size | 16,280 |
A WaitGroup waits for a collection of task to finish.
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;
}
This project is licensed under Apache License, Version 2.0 (LICENSE ).