#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

#627 in Asynchronous

Download history 13880/week @ 2024-03-14 15466/week @ 2024-03-21 15333/week @ 2024-03-28 15641/week @ 2024-04-04 13163/week @ 2024-04-11 14012/week @ 2024-04-18 15723/week @ 2024-04-25 14366/week @ 2024-05-02 15020/week @ 2024-05-09 16223/week @ 2024-05-16 13056/week @ 2024-05-23 13143/week @ 2024-05-30 11676/week @ 2024-06-06 11581/week @ 2024-06-13 12426/week @ 2024-06-20 9280/week @ 2024-06-27

47,168 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