Fiberized.IO is a fast and simple framework without compromises.
- Fast
Asynchronous I/O under the hood for maximum speed and throughtput. - Simple
Fiber based programming model for concise and intuitive development. - No compromises
Standard C++ thread and iostream compatible API, old-fashion programs just work more efficiently.
#include <iostream>
#include <fibio/fiber.hpp>
#include <fibio/stream/iostream.hpp>
using namespace fibio;
int main_fiber(int argc, char *argv[]) {
auto acc=io::listen(atoi(argv[1]));
while(1) {
fiber([](tcp_stream s){
while(!s.eof()) {
std::string line;
std::getline(s, line);
s << line << std::endl;
}
}, io::accept(acc)).detach();
}
return 0;
}
int main(int argc, char *argv[]) {
return fibio::fibers::fiberize(4, main_fiber, argc, argv);
}