3 ms·
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,
by mort96 1y 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.
- ahartmetz 1y agoFor sure. Though every platform does have it own high-performance alternative, with only kqueue shared by some less popular ones.
- usrnm 1y agoAren'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
- mort96 1y agoSure, 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
- Galanwe 1y agoI wouldn't count uv/ev/etc as "big heavy IO wrapper library".
- mort96 1y agoI would, especially when nothing else in the program uses it and you just introduce it for one small thing in place of calling poll(). It's over 40 000 loc, over 70 000 including tests.
- paulddraper 1y agoI certainly would
- ninjin 1y agoWhich is why there is libevent [1]? [1]: https://libevent.org 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.