3个版本
| 0.1.2 | 2021年2月25日 |
|---|---|
| 0.1.1 | 2021年2月25日 |
| 0.1.0 | 2021年2月23日 |
760 在 并发
10,934 每月下载量
用于 55 个Crate (5个直接使用)
21KB
432 行
yastl
yastl 是一个为Rust设计的另一个作用域线程池库。
yastl 非常受 scoped_threadpool 和 scoped_pool Crate 的启发。它主要是将 scoped_pool Crate 移植到现代Rust的版本。
示例
use yastl::Pool;
fn main() {
let pool = Pool::new(4);
let mut list = vec![1, 2, 3, 4, 5];
pool.scoped(|scope| {
// since the `scope` guarantees that the threads are finished if it drops,
// we can safely borrow `list` inside here.
for x in list.iter_mut() {
scope.execute(move || {
*x += 2;
});
}
});
assert_eq!(list, vec![3, 4, 5, 6, 7]);
}
功能标志
coz:启用对coz分析器的支持。在每一个新线程中调用coz::thread_init()。
许可协议
MIT 许可协议下。
依赖项
~260KB