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

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

#877 in Asynchronous

Download history 15317/week @ 2024-08-16 15790/week @ 2024-08-23 14829/week @ 2024-08-30 11887/week @ 2024-09-06 12771/week @ 2024-09-13 13266/week @ 2024-09-20 12823/week @ 2024-09-27 12368/week @ 2024-10-04 12288/week @ 2024-10-11 10265/week @ 2024-10-18 10009/week @ 2024-10-25 10879/week @ 2024-11-01 12778/week @ 2024-11-08 9744/week @ 2024-11-15 9149/week @ 2024-11-22 7229/week @ 2024-11-29

40,959 downloads per month
Used in 89 crates (11 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