2 个版本
0.1.1 | 2022年7月7日 |
---|---|
0.1.0 | 2022年4月27日 |
#914 in 并发
用于 tender
8KB
111 行
sync-wait-group
用于同步某些计算的开始或结束的等待组。
此 crate 重复了来自 WaitGroup
的 crossbeam_utils::sync::WaitGroup
,但使用 parking_lot::{Mutex, Condvar}
而不是 std::sync::{Mutex, Condvar}
。
示例
use sync_wait_group::WaitGroup;
use std::thread;
// Create a new wait group.
let wg = WaitGroup::new();
for _ in 0..4 {
// Create another reference to the wait group.
let wg = wg.clone();
thread::spawn(move || {
// Do some work.
// Drop the reference to the wait group.
drop(wg);
});
}
// Block until all threads have finished their work.
wg.wait();
Rust 版本
sync-wait-group
此版本需要 Rust 1.56 或更高版本。
许可证
双许可以与 Rust 项目兼容。
根据您的选择,受 Apache 许可证 2.0 版本 https://apache.ac.cn/licenses/LICENSE-2.0 或 MIT 许可证的约束,此文件不得复制、修改或分发,除非根据这些条款。
贡献
除非您明确声明,否则您提交给 sync-wait-group
的任何有意贡献都应按照 Apache-2.0 和 MIT 许可证许可,没有额外的条款或条件。
依赖项
~0.4–5.5MB
~11K SLoC