6 个版本
0.1.4 | 2021年5月8日 |
---|---|
0.1.3 | 2021年5月6日 |
0.0.0 | 2021年4月22日 |
#36 in #worker-thread
25KB
570 代码行数(不含注释)
uexec
简单的工作窃取全局和本地执行器
特性
- 暂无可选功能
示例
use futures_lite::future;
// spawn several worker threads
uexec::spawn_workers(4);
// spawn a task on the multi-threaded executor
let task1 = uexec::spawn(async {
1 + 2
});
// spawn a task on the local executor (same thread)
let task2 = uexec::spawn_local(async {
3 + 4
});
let task = future::zip(task1, task2);
// run the executor
uexec::block_on(async {
assert_eq!(task.await, (3, 7));
});
// terminate our worker threads
uexec::terminate_workers();
许可协议
许可协议为以下之一
- Apache License, Version 2.0 (LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT 或 https://open-source.org.cn/licenses/MIT)
您可选择其中之一。
贡献
除非您明确说明,否则您有意提交的任何贡献,根据Apache-2.0许可协议定义,应如上所述双重许可,不附加任何额外条款或条件。
依赖项
~0.8–1.2MB
~19K SLoC