#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

#871 in Asynchronous

Download history 9556/week @ 2024-11-16 8188/week @ 2024-11-23 8847/week @ 2024-11-30 9470/week @ 2024-12-07 9903/week @ 2024-12-14 5084/week @ 2024-12-21 5766/week @ 2024-12-28 11442/week @ 2025-01-04 11631/week @ 2025-01-11 9364/week @ 2025-01-18 10959/week @ 2025-01-25 12272/week @ 2025-02-01 11071/week @ 2025-02-08 10971/week @ 2025-02-15 16731/week @ 2025-02-22 11515/week @ 2025-03-01

52,433 downloads per month
Used in 97 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