> ref: [ruby-core:35527]
>
> This adds a new C API function with the following prototype:
>
> =A0 rb_io_poll_fd(int fd, short events, int timeout);
>
> It is emulated using select() for platforms that we do not support
> poll() for. =A0It is much easier to use than rb_thread_select() and
> rb_thread_fd_select() for the common case in C extensions[1].
>
> For Linux (and eventually any other platforms where poll() works for all
> select()-able files), we actually implement rb_io_poll_fd() using the
> poll() system call which means it is faster for high numbered file
> descriptors and does not put malloc pressure on the garbage collector.

Meta review comment. All performance patches should have mesured
performance number.

And, if you really want to care C10K scalability issue, why don't you use
epoll?


>
> Lastly, since IO.select() is commonly used with a single IO object
> in my experience, we will try to use rb_io_poll_fd() in that case.
>
> There is also a new testcase for io/wait since I needed to verify my
> changes to ext/io/wait.c were correct.
>
> No failures were introduced to test-all and test-rubyspec targets with
> either the select() or poll()-based implementation of rb_io_poll_fd()
> on my platform (Linux x86_64)