How jbaldwin/libcoro works
Project type and purpose
• This is libcoro, a C++20 open-source coroutine library focused on providing low-level coroutine primitives, schedulers, and high-performance networking support.
• It is not a full-stack application; rather it is a library/toolkit for building asynchronous coroutines, I/O schedulers, thread pools, and networking/TLS clients and servers.
File structure
• Top-level build/config files: CMakeLists.txt, Makefile, .github workflows, git submodules.
• Source code broken into:
• include/coro/ – public headers defining API (task, generator, event, mutex, net, etc.)
• src/ – implementation of the above APIs
• examples/ – sample applications (TCP echo server, HTTP server, etc.)
• test/ – Catch2 tests for each primitive and networking module
• vendor/libc-ares submodule for async DNS
• Key modules apparent from directory names:
• core coroutine machinery (task, promise, awaitable)
• schedulers (thread_pool, io_scheduler)
• primitives (event, latch, mutex, semaphore, queue, ring_buffer, condition_variable)
• networking (net::dns, net::tcp, net::tls, net::udp)
• examples and tests exercising all of the above.
README for additional insights
• The README explains the API surface, usage examples for each primitive, and the architecture:
• core constructs → schedulers → networking.
• External dependencies: pthreads, epoll (Linux), libc-ares, OpenSSL.
Detailed coverage
• External Dependencies outside the library: libc-ares, OpenSSL, Linux Kernel epoll, pthreads.