← Back to context

Comment by mort96

1 day ago

I wish the UNIXes had gone together and standardized a modern alternative to poll, maybe as part of POSIX. It sucks that any time I want to listen to IO events, I have to choose between old, low performance, cross-platform APIs and the new, higher-performance but Linux-only epoll.

Which is why there is libevent [1]?

[1]: https://libevent.org

Unless I am mistaken, OpenBSD base even explicitly codes against the older libevent API internally and ships it with each release, despite at the very least supporting kqueue, and thus gains better portability for a number of their tools this way.

Personally, I just go with Posix select for small programs where performance is not critical anyway.

  • There are a whole bunch of these — libevent, libev, glib's main loop, Qt's main loop, Apache's modular event loop, …

    …which is why there is libverto, a 2nd order abstraction.

    It'd be funny if it weren't also sad.

Aren't there enough wrapper libraries for all programming languages that take care of this under the hood? You don't have to rely on libc only

  • Sure, there are wrapper libraries. But then I'm met with the question: do I add some big heavy handed IO wrapper library, or ... do I just call poll

For sure. Though every platform does have it own high-performance alternative, with only kqueue shared by some less popular ones.