Condy v1.9
C++ Asynchronous System Call Layer for Linux
Loading...
Searching...
No Matches
Condy🍬

C++ License Release Stars

CI (Main) CI (Latest Kernel) CI (Toolchain) CI (Static Check) CI (Execution) Deploy Docs

C++ Asynchronous System Call Layer for Linux, Powered by io_uring and C++20 Coroutines

Condy is designed to provide an intuitive, high-performance coroutine runtime on top of io_uring:

  • Comprehensive io_uring Integration Designed to integrate and maintain support for most io_uring features, with ongoing updates to track kernel and liburing advancements.
  • Low Overhead Efficient template-based abstractions and precise lifetime management eliminate nearly all heap allocations outside coroutine frames, resulting in extremely low runtime overhead.
  • Intuitive Programming Model Write asynchronous code in a direct, readable style using C++20 coroutines—no callbacks. Friendly APIs, high-level combinators, and channels make complex async flows easy to express.
  • Ready for std::execution Condy's senders satisfy the standard sender concept and compose directly with the C++26 execution ecosystem.

Quick Start

// hello.cpp
#include <condy.hpp>
condy::Coro<> co_main() {
std::string msg = "Hello, Condy!\n";
co_await condy::async_write(STDOUT_FILENO, condy::buffer(msg), 0);
}
int main() { condy::sync_wait(co_main()); }
Coroutine type used to define a coroutine function.
Definition coro.hpp:25
Main include file for the Condy library.
T sync_wait(Runtime &runtime, Coro< T, Allocator > coro)
Synchronously wait for a coroutine to complete in the given runtime.
Definition sync_wait.hpp:25
MutableBuffer buffer(void *data, size_t size) noexcept
Create a buffer object from various data sources.
Definition buffers.hpp:86
auto async_write(Fd fd, const Buffer &buf, __u64 offset, int flags=0)
See io_uring_prep_write.
# Make sure liburing (>=2.3) is installed on your system
# On Ubuntu: sudo apt install liburing-dev
c++ hello.cpp -o hello -std=c++20 -luring -I./include
./hello
# Hello, Condy!

See Documentation for more details.

Using std::execution

When a std::execution implementation is available, Condy's operations become standard senders and can be used from execution-style code. See Building and Usage for how to enable an implementation.

// hello_execution.cpp
#include <condy.hpp>
#include <string>
#include <thread>
// C++26; otherwise <stdexec/execution.hpp> or <beman/execution.hpp>
#include <execution>
namespace ex = /* ... */ ;
int main() {
condy::Runtime runtime;
std::jthread runtime_thread([&] { runtime.run(); });
std::string msg = "Hello, Condy!\n";
auto [r] = ex::sync_wait(ex::starts_on(
condy::get_scheduler(runtime),
condy::async_write(STDOUT_FILENO, condy::buffer(msg), 0))).value();
runtime.allow_exit();
return r < 0;
}
The event loop runtime for executing asynchronous.
Definition runtime.hpp:36
void run()
Run the runtime event loop in the current thread.
Definition runtime.hpp:138
void allow_exit() noexcept
Allow the runtime to exit when there are no pending works.
Definition runtime.hpp:125

Documentation

Support

  • For questions, bug reports, or feature requests, please open an issue.
  • Pull requests are welcome!