Migrate from select to rb_thread_fd_select

This patch seems to work fine and restores the old behavior: the threads aren't blocked anymore.