coio is a modern C++20 library that provides asynchronous programming facilities built on std::execution (sender/receiver model, P2300) and C++20 coroutines.
what's sender/receiver?
- P2300 - std::execution: Senders proposal to C++ Standard
- What are Senders Good For, Anyway?: Demonstrates the value of a standard async programming model by wrapping a C-style async API in a sender
- Sender/Receiver model — Composable asynchronous algorithms via
std::execution - Coroutine types —
task<T, Alloc>andgenerator<Ref, Val>for async computations and lazy sequences - Execution contexts —
time_loop,epoll_context,uring_contextwith thread-saferun() - Networking — TCP/UDP sockets with sync and async operations (Linux)
- Synchronization —
async_mutex,async_semaphore,async_latch - Utilities — Timers, concurrent queues, signal handling
Note
Some network and async-io facilities are currently only implemented using epoll and io_uring on linux.
- C++20 compatible compiler (GCC 10+, Clang 10+, MSVC 2019+)
- CMake 3.26+
COIO_BUILD_EXAMPLES(ON/OFF, default OFF) - Build example programsCOIO_SENDERS_BACKEND(NVIDIA/BEMAN/CXX26, default NVIDIA) - Which std::execution implementation to use:NVIDIA- NVIDIA/stdexec implementationBEMAN- bemanproject/execution implementationCXX26- Standard library implementation (C++26+)
- liburing (only if using
uring_context) - NVIDIA/stdexec (only if using
NVIDIAstd::execution implement) - bemanproject/execution (only if using
BEMANstd::execution implement)
cmake -S . -B <build directory>
cmake --build <build directory>cmake -S . -B <build directory> -DCOIO_BUILD_EXAMPLES=ON
cmake --build <build directory>cmake --install <build directory> --prefix <install directory>After installation, use in your CMakeLists.txt:
find_package(coio REQUIRED)
target_link_libraries(your_target PRIVATE coio::coio)