#async-task #async #future #notify #wake

waitgroup

Async waitgroup for a collection of task to finish

3 releases

0.1.2 Oct 8, 2020
0.1.1 Apr 14, 2020
0.1.0 Feb 28, 2020

#598 in Asynchronous

Download history 28100/week @ 2023-12-17 9662/week @ 2023-12-24 18507/week @ 2023-12-31 23029/week @ 2024-01-07 22477/week @ 2024-01-14 21230/week @ 2024-01-21 25299/week @ 2024-01-28 20337/week @ 2024-02-04 24008/week @ 2024-02-11 13670/week @ 2024-02-18 13117/week @ 2024-02-25 14202/week @ 2024-03-03 14589/week @ 2024-03-10 14717/week @ 2024-03-17 15192/week @ 2024-03-24 16666/week @ 2024-03-31

62,200 downloads per month
Used in 81 crates (10 directly)

Apache-2.0

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