diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2021-02-09 19:39:56 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-09 19:39:56 +1300 |
commit | 5f69a7f60467fa58c2f998daffab43e118bff36c (patch) | |
tree | f60e3a5add29eb9cc7e68433c4e373e2a2facab7 /ext/io/console/console.c | |
parent | 3c593f28ede99b77d4fe3258f9bda78dcee238a3 (diff) |
Expose scheduler as public interface & bug fixes. (#3945)
* Rename `rb_scheduler` to `rb_fiber_scheduler`.
* Use public interface if available.
* Use `rb_check_funcall` where possible.
* Don't use `unblock` unless the fiber was non-blocking.
Notes
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'ext/io/console/console.c')
-rw-r--r-- | ext/io/console/console.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 2e2467036d..6999a3f077 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -80,8 +80,11 @@ static ID id_getc, id_console, id_close, id_min, id_time, id_intr; static ID id_gets, id_chomp_bang; #endif -#ifdef HAVE_RB_SCHEDULER_TIMEOUT +#if defined HAVE_RUBY_FIBER_SCHEDULER_H +# include "ruby/fiber/scheduler.h" +#elif defined HAVE_RB_SCHEDULER_TIMEOUT extern VALUE rb_scheduler_timeout(struct timeval *timeout); +# define rb_fiber_scheduler_timeout rb_scheduler_timeout #endif #define sys_fail_fptr(fptr) rb_sys_fail_str((fptr)->pathv) @@ -534,7 +537,7 @@ console_getch(int argc, VALUE *argv, VALUE io) tv.tv_sec = optp->vtime / 10; tv.tv_usec = (optp->vtime % 10) * 100000; # ifdef HAVE_RB_IO_WAIT - timeout = rb_scheduler_timeout(&tv); + timeout = rb_fiber_scheduler_make_timeout(&tv); # endif } switch (optp->vmin) { |