I’ve made the first tagged release of my low-level async I/O library. You can see it as an alternative to libxev or libuv. The need for this library came after I started implementing the std.Io interface in my coroutine runtime, and realized that it’s going to be super hard to upgrade libxev, with most of the low level wrappers in the standard library being removed in Zig 0.16.
I don’t expect many people wanting to use something like this, since it’s much easier to use it indirectly via zio, either using the native API or via the std.Io interface it implements. However, I could see some use cases, on embedded systems that still have some operating system, or some specialized software where coroutines are not a good fit.
There are a few differences, compared to libxev:
- The same code working on Zig 0.15 and 0.16
- Separate completion structs per operation to optimize memory usage
- User-mode timers on all backends for consistent behavior and immediate cancellations/resets
- Network poll operations for integration with legacy systems
- NetBSD/kqueue support
- Plain old poll support, which should work on pretty much any POSIX system
- Fully asynchronous Windows/IOCP backend, including using ConnectEx/AcceptEx
- Aware of multi threading, able to configure multiple loops in a group, needed if you want to e.g. load balance socket handles on multiple threads using Windows/IOCP
- Very minimal dependency on std to make it more compatible with future Zig changes
Sources: