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 /include/ruby | |
parent | 1acc1a5c6d5d01b2822d7aa4356208095481724b (diff) | |
download | ruby-8a420670a29a7c78c7201f678eb26528621bf39f.tar.gz |
Introduce `Fiber::Scheduler#io_select` hook for non-blocking `IO.select`. (#6559)
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/fiber/scheduler.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/ruby/fiber/scheduler.h b/include/ruby/fiber/scheduler.h index 37985e1285..d6a033d322 100644 --- a/include/ruby/fiber/scheduler.h +++ b/include/ruby/fiber/scheduler.h @@ -244,7 +244,27 @@ VALUE rb_fiber_scheduler_io_wait_readable(VALUE scheduler, VALUE io); VALUE rb_fiber_scheduler_io_wait_writable(VALUE scheduler, VALUE io); /** - * Nonblocking read from the passed IO. + * Non-blocking version of `IO.select`. + * + * It's possible that this will be emulated using a thread, so you should not + * rely on it for high performance. + * + * @param[in] scheduler Target scheduler. + * @param[in] readables An array of readable objects. + * @param[in] writables An array of writable objects. + * @param[in] exceptables An array of objects that might encounter exceptional conditions. + * @param[in] timeout Numeric timeout or nil. + * @return What `scheduler.io_select` returns, normally a 3-tuple of arrays of ready objects. + */ +VALUE rb_fiber_scheduler_io_select(VALUE scheduler, VALUE readables, VALUE writables, VALUE exceptables, VALUE timeout); + +/** + * Non-blocking version of `IO.select`, `argv` variant. + */ +VALUE rb_fiber_scheduler_io_selectv(VALUE scheduler, int argc, VALUE *argv); + +/** + * Non-blocking read from the passed IO. * * @param[in] scheduler Target scheduler. * @param[out] io An io object to read from. |