I’d like to wrap a C library for use within Eio code. That library opens a network connection on its own, but I’m able to fetch the file descriptor of the open socket. It even operates in non-blocking mode.
But how do I wait in Eio until new input is available?
Can I somehow e.g. wrap that file descriptor into an Eio.Resource or Eio.Flow, and read from it without actually reading any single byte (as that would disturb the C library)?
I’m aware that I could call Unix.socket or Unix.poll, and that I would have to wrap it within Eio_unix.run_in_systhread. However, is there a way without starting a separate thread?
(That seems a bit wasteful to me, given that the library is already non-blocking. And it sounds a big absurd, given that e.g. the Eio_posix implementation of Eio is already operating a central Unix.select loop under the hood anyways. Is there any way to leverage on that?)