From 8a420670a29a7c78c7201f678eb26528621bf39f Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sat, 15 Oct 2022 19:59:04 +1300 Subject: Introduce `Fiber::Scheduler#io_select` hook for non-blocking `IO.select`. (#6559) --- io.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'io.c') diff --git a/io.c b/io.c index 2fe092b84e..a1b3f27611 100644 --- a/io.c +++ b/io.c @@ -10851,6 +10851,15 @@ rb_io_advise(int argc, VALUE *argv, VALUE io) static VALUE rb_f_select(int argc, VALUE *argv, VALUE obj) { + VALUE scheduler = rb_fiber_scheduler_current(); + if (scheduler != Qnil) { + // It's optionally supported. + VALUE result = rb_fiber_scheduler_io_selectv(scheduler, argc, argv); + if (result != Qundef) { + return result; + } + } + VALUE timeout; struct select_args args; struct timeval timerec; -- cgit v1.2.1