Skip to content

Instantly share code, notes, and snippets.

@HappyCerberus
Created November 30, 2021 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HappyCerberus/d94965520ef69f126c811fb3225f5644 to your computer and use it in GitHub Desktop.
Save HappyCerberus/d94965520ef69f126c811fb3225f5644 to your computer and use it in GitHub Desktop.
[Article] C++20 Practical Coroutines - main detached
auto &sched = ces::main_scheduler();
sched.register_emitter(std::make_unique<ces::TimeoutEmitter>());
sched.register_emitter(std::make_unique<ces::ConditionEmitter>());
sched.register_emitter(std::make_unique<ces::EpollEmitter>());
ces::Socket s =
ces::Socket::ServerSocket(ces::SockAddr(ces::IPv4{}, "127.0.0.1", 9090));
auto server = async_server(s.without_timeout(), echo_server_handle);
auto client = echo_client(s.without_timeout());
sched.schedule(server);
sched.schedule(client);
sched.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment