Tristan Peralta

Systems 2026

c3io

Async I/O for C3: one event loop, no hidden threads.

c3io wraps libuv in C3 modules for non-blocking networking, file I/O, and background work. It fits programs that already run their own loop — a game can call run_nowait() once per frame and nothing blocks; a server can run the loop continuously; a tool can drain it until the work is done.

What it covers

The library is split by concern rather than by libuv handle type:

  • c3io::event_loop — run modes, cancellation, and non-blocking shutdown.
  • c3io::net — SocketAddr, an IPv4 or IPv6 address and port that compares and hashes.
  • c3io::tcp — clients and servers with try_write and pooled write, so a slow peer never stalls the frame.
  • c3io::udp — try_send, pooled sends, connected sockets, and broadcast.
  • c3io::dns — asynchronous name resolution.
  • c3io::file and c3io::fswatch — whole-file reads, change notifications, and stat polling.
  • c3io::work — functions on libuv’s thread pool, completed back on the loop thread.
  • c3io::timer — one-shot and repeating timers.
  • c3io::uv — the raw bindings the modules are built on.

The design rule

No call blocks and no call takes over the program. Every operation either completes immediately or reports that it is in progress, and completion is delivered on the loop thread. That is a different contract from a typical async library, and it is what makes the same code usable in a render loop and in a server.

c3io is the foundation under c3web, and it runs on Linux, macOS, and Windows.