You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kmx-aio is a modern, high-performance C++26 asynchronous I/O library designed for building non-blocking network applications on Linux. It leverages C++ coroutines to provide a clean, synchronous-looking API for asynchronous operations across two execution models: readiness (epoll) and completion (io_uring).
Key Features
Modern C++26: Built with the latest language standards.
Coroutine-First Design: Uses co_await for intuitive, sequential async code flow without callback hell.
Readiness + Completion Models: epoll-based readiness and io_uring-based completion APIs.
Zero-Overhead Abstractions: Lightweight wrappers around system calls.
Type-Safe Error Handling: Extensive use of std::expected and std::error_code for robust error management.
TCP Networking: Built-in support for TCP listeners and streams.
UDP Networking: Dual-layer API in both models — low-level socket wrapping recvmsg/sendmsg and high-level endpoint with span-based send/receive and automatic peer-address decoding, as readiness::udp::{socket,endpoint} and completion::udp::{socket,endpoint}.
HTTP/2: Full codec, stream, frame, and HPACK serialization stack (no model affinity).
V4L2 Async Capture (Readiness + Completion): Readiness mode uses epoll-driven frame capture; completion mode uses IORING_OP_POLL_ADD plus synchronous VIDIOC_DQBUF (hybrid model) in the same io_uring executor. Targets V4L2 streaming devices such as USB webcams, MIPI CSI-2 pipelines, and GMSL camera chains. Frames land in co_await-returned frame_view objects that auto-requeue mmap'd kernel buffers on destruction.
Completion async_poll(fd, mask): First-class one-shot IORING_OP_POLL_ADD primitive to await arbitrary fd readiness (V4L2, eventfd, timerfd, signalfd, netlink) inside completion::executor; callers re-arm by invoking it again.
Async Mutex: kmx::aio::async_mutex is acquired with co_await and can be held across a suspension — it parks the coroutine instead of blocking the worker thread, and hands ownership straight from the releasing holder to the first waiter in line.
Coroutine-Frame Slab Allocator: kmx::aio::allocator::slab serves coroutine frames from a per-thread slab. Each frame carries its origin in a header, so one allocated on the executor thread and freed on another goes back to the right slab through a lock-free remote list rather than corrupting the heap.
Thread-Pool Scheduler: kmx::aio::scheduler runs submitted callables on a fixed set of workers, with wait_until_idle() for owners that have to outlive their own queued work.
Buffer Pool Primitives: kmx::aio::buffer::pool and kmx::aio::buffer::handle provide fixed-capacity RAII buffer leasing for deterministic zero-copy workflows.
Channel Backpressure: kmx::aio::channel supports watermark-based producer throttling and credit reporting.
OPC UA: Backend-neutral async client/server/subscription facade with open62541 backend support; this repository drives it through completion-executor progression, with a shim fallback for feature-off builds and tests.
Modbus TCP and Modbus/TLS: Feature-gated readiness-model client/server facade with framing helpers, TLS/mTLS coverage, and deterministic unit/integration test harnesses.
SOME/IP: Backend-neutral async client/server/subscription facade for AUTOSAR SOME/IP communication; vsomeip-backed when available, with an in-process stub for deterministic unit testing without a daemon.
GPU Completion Model (CUDA): Lightweight thread-per-core gpu::executor allowing co_await on asynchronous CUDA event completions (gpu::event) submitted to CUDA streams (gpu::stream).
AVB (Audio Video Bridging, IEEE 802.1): Shared generic raw Ethernet socket, gPTP clock synchronization, and SRP client with model-specific aliases for readiness and completion; sample-validated in both models.
HFT Order Router Sample: Completion-sample demo using kmx::aio::channel between CPU-pinned threads to show producer throttling and synthetic order routing stats.
No gate of its own; rides on whichever executor backend is enabled
This table says which model a feature works in. For how the two compare where both are available,
kmx-aio-benchmark runs one scenario body on each executor and prints them side by side - see
Benchmarking.