基于 C++20 coroutine 的异步框架 (需要 C++23 支持).
依赖目标 asco::main:
#include <print>
#include <asco/future.h>
using namespace asco;
future<void> foo() {
std::println("foo() called");
co_return;
}
future<int> async_main() { // asco::main 提供的入口
auto f = foo();
std::println("async_main() running");
co_await f;
std::println("foo() completed");
co_return 0;
}- 将本仓库添加为 Git 子模块
- 用 cmake 导入:
- 静态链接:
add_subdirectory(<path-to-this-repo>)
target_link_libraries(<your-target> PRIVATE asco::core asco::main)- 动态链接:
add_subdirectory(<path-to-this-repo>)
target_link_libraries(<your-target> PRIVATE asco::shared::core asco::shared::main)include(FetchContent)
FetchContent_Declare(
asco
GIT_REPOSITORY https://github.com/pointertobios/asco.git
GIT_TAG <version-tag>
)
FetchContent_MakeAvailable(asco)
非叶子项打 ✔ 表示特性已可用但可能不完整
- 异步运行时
- Linux 完整支持
- Windows 完整支持
- MacOS 完整支持
- 核心运行时
- 线程池 runtime
- 任务取消机制
- 动态优先级
- 异步任务本地存储
- 任务偷窃
- 计时器
- 高分辨率计时器
- 时间轮
- IO 兼容层
- io_uring (Linux)
- Epoll (Linux)
- IOCP (Windows)
- 测试框架
- 并发
- 同步原语
- 自旋锁
- 信号量
- 任务取消支持
- 通道
- 任务取消支持
- 互斥锁
- 任务取消支持
- 读写锁
- 任务取消支持
- 条件变量
- 任务取消支持
- 屏障
- 任务取消支持
- 门闩
- 任务取消支持
- 定时器与超时
- 任务取消支持
- 无锁数据结构与算法
- 环形队列
- 双端队列
- 同步原语
- 异步 IO
- 文件
- 网络
- 远程过程调用(RPC)
- Clang: 完整支持
- GCC: 不完全支持
- MSVC: 仅支持 VS 2026 及以上版本的 clang 模式
阅读 CONTRIBUTING.md 了解详情。
本项目使用 MIT License 发布.
Copyright (C) 2025 pointer-to-bios pointer-to-bios@outlook.com
完整的法律条款参见 LICENSE。