summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-10-15 19:59:04 +1300
committerGitHub <noreply@github.com>2022-10-15 19:59:04 +1300
commit8a420670a29a7c78c7201f678eb26528621bf39f (patch)
tree817a970087e36934979a4c9d4747f310b6224e42 /io.c
parent1acc1a5c6d5d01b2822d7aa4356208095481724b (diff)
downloadruby-8a420670a29a7c78c7201f678eb26528621bf39f.tar.gz
Introduce `Fiber::Scheduler#io_select` hook for non-blocking `IO.select`. (#6559)
Diffstat (limited to 'io.c')
-rw-r--r--io.c9
1 files changed, 9 insertions, 0 deletions
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;