#notify #wake #futures #async

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

#391 in Asynchronous

Download history 33221/week @ 2023-05-31 31014/week @ 2023-06-07 35482/week @ 2023-06-14 35474/week @ 2023-06-21 31232/week @ 2023-06-28 29547/week @ 2023-07-05 31915/week @ 2023-07-12 33110/week @ 2023-07-19 21463/week @ 2023-07-26 22468/week @ 2023-08-02 18056/week @ 2023-08-09 27867/week @ 2023-08-16 42383/week @ 2023-08-23 47658/week @ 2023-08-30 45594/week @ 2023-09-06 37654/week @ 2023-09-13

178,458 downloads per month
Used in 170 crates (6 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