diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2022-10-15 19:59:04 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-15 19:59:04 +1300 |
commit | 8a420670a29a7c78c7201f678eb26528621bf39f (patch) | |
tree | 817a970087e36934979a4c9d4747f310b6224e42 /io.c | |
parent | 1acc1a5c6d5d01b2822d7aa4356208095481724b (diff) |
Introduce `Fiber::Scheduler#io_select` hook for non-blocking `IO.select`. (#6559)
Notes
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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; |