How does one actually use kqueue()
for doing simple async r/w's?
It's inception seems to be as a replacement for epoll()
, and select()
, and thus the problem it is trying to solve is scaling to listening on large number of file descriptors for changes.
However, if I want to do something like: read data from descriptor X, let me know when the data is ready - how does the API support that? Unless there is a complimentary API for kicking-off non-blocking r/w requests, I don't see a way other than managing a thread pool myself, which defeats the purpose.
Is this simply the wrong tool for the job? Stick with aio
?
Aside: I'm not savvy with how modern BSD-based OS internals work - but is kqueue()
built on aio
or visa-versa? I would imagine it would depend on whether the OS io subsystem system is fundamentally interrupt-driven or polling.