Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/8sileus/zedio
A runtime for writing asynchronous applications with Modern C++, based on C++20 coroutine and liburing (io-uring)
https://github.com/8sileus/zedio
asynchronous coroutines framework io-uring runtime
Last synced: 6 days ago
JSON representation
A runtime for writing asynchronous applications with Modern C++, based on C++20 coroutine and liburing (io-uring)
- Host: GitHub
- URL: https://github.com/8sileus/zedio
- Owner: 8sileus
- License: mit
- Created: 2023-09-21T03:46:38.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-14T14:54:35.000Z (6 months ago)
- Last Synced: 2024-08-02T06:11:56.908Z (3 months ago)
- Topics: asynchronous, coroutines, framework, io-uring, runtime
- Language: C++
- Homepage: https://8sileus.github.io/zedio/
- Size: 860 KB
- Stars: 83
- Watchers: 2
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-modern-cpp - zedio
README
# Zedio
[![C++23](https://img.shields.io/static/v1?label=standard&message=C%2B%2B23&color=blue&logo=c%2B%2B&&logoColor=white&style=flat)](https://en.cppreference.com/w/cpp/compiler_support)
![Platform](https://img.shields.io/static/v1?label=platform&message=linux&color=dimgray&style=flat)```
______ ______ _____ _____ ____
|___ / | ____| | __ \ |_ _| / __ \
/ / | |__ | | | | | | | | | |
/ / | __| | | | | | | | | | |
/ /__ | |____ | |__| | _| |_ | |__| |
/_____| |______| |_____/ |_____| \____/
```Documentation: https://8sileus.github.io/zedio/
Zedio is an event-driven header library for writing asynchronous applications in modern C++:
## Feature:
+ Multithreaded, work-stealing based task scheduler. (reference [tokio](https://tokio.rs/))
+ Proactor event handling backed by [io_uring](https://github.com/axboe/liburing).
+ Zero overhead abstraction, no virtual, no dynamic## Sub library:
+ **I/O**
+ **NetWorking**
+ **FileSystem**
+ **Time**
+ **Sync**
+ **Log**It's being developed, if you're interested in zedio and want to participate in its development, see [contributing](./docs/zedio/contributing.md)
# Example
```C++
// An echo server
// Ignore all errors
#include "zedio/core.hpp"
#include "zedio/net.hpp"using namespace zedio;
using namespace zedio::async;
using namespace zedio::net;auto process(TcpStream stream) -> Task {
char buf[1024]{};
while (true) {
auto len = (co_await (stream.read(buf))).value();
if (len == 0) {
break;
}
co_await stream.write_all({buf, len});
}
}auto server() -> Task {
auto addr = SocketAddr::parse("localhost", 9999).value();
auto listener = TcpListener::bind(addr).value();
while (true) {
auto [stream, addr] = (co_await listener.accept()).value();
spawn(process(std::move(stream)));
}
}auto main() -> int {
// zedio::runtime::CurrentThreadBuilder::default_create().block_on(server());
zedio::runtime::MultiThreadBuilder::default_create().block_on(server());
}
```