T
Toby DiPasquale
Hi all,
I'm writing a C extension for Ruby to bind to the epoll(4) facility in
later Linux kernels (one for *BSD's kqueue will be coming after that) and
I've hit a snag.
epoll_wait(2) returns a list of epoll_event records, each of which
contains (among other things) the fd that the particular event fired on.
However, unlike select(2), the whole point of epoll(4) is that you
don't need to maintain and pass in big arrays of fds each time you do a
call. Unfortunately for me, those input arrays are exactly the method by
which Kernel#select can map the results back into the output arrays.
So, is there a way in the Ruby source to map a fd to its associated IO
object? I do have the option of maintaining a list/hash when the IO
objects are inserted, but this would negate the main advantage of epoll(4)
so I'd understandably not like to have to do that. Thanks in advance.
I'm writing a C extension for Ruby to bind to the epoll(4) facility in
later Linux kernels (one for *BSD's kqueue will be coming after that) and
I've hit a snag.
epoll_wait(2) returns a list of epoll_event records, each of which
contains (among other things) the fd that the particular event fired on.
However, unlike select(2), the whole point of epoll(4) is that you
don't need to maintain and pass in big arrays of fds each time you do a
call. Unfortunately for me, those input arrays are exactly the method by
which Kernel#select can map the results back into the output arrays.
So, is there a way in the Ruby source to map a fd to its associated IO
object? I do have the option of maintaining a list/hash when the IO
objects are inserted, but this would negate the main advantage of epoll(4)
so I'd understandably not like to have to do that. Thanks in advance.