#async-task #future #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

#965 in Asynchronous

Download history 12496/week @ 2024-06-10 10528/week @ 2024-06-17 12534/week @ 2024-06-24 10222/week @ 2024-07-01 12321/week @ 2024-07-08 13645/week @ 2024-07-15 11230/week @ 2024-07-22 13647/week @ 2024-07-29 14555/week @ 2024-08-05 18029/week @ 2024-08-12 14243/week @ 2024-08-19 16247/week @ 2024-08-26 13506/week @ 2024-09-02 12334/week @ 2024-09-09 12176/week @ 2024-09-16 13297/week @ 2024-09-23

52,191 downloads per month
Used in 86 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