diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-09-20 11:34:02 +1200 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-09-21 09:51:33 +1200 |
commit | 501fff14c7657f769d68f90de98fd2ebccb807fb (patch) | |
tree | 10dfcaf36b27dcd6b83268f9b0de2516fed41ec2 /scheduler.c | |
parent | b6d599d76ec85422bea16b63f105985cf08e04bd (diff) |
When setting current thread scheduler to nil, invoke `#close`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3557
Diffstat (limited to 'scheduler.c')
-rw-r--r-- | scheduler.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/scheduler.c b/scheduler.c index f038eed9ef..2dfecafca5 100644 --- a/scheduler.c +++ b/scheduler.c @@ -11,9 +11,13 @@ #include "internal/scheduler.h" #include "ruby/io.h" -static ID id_kernel_sleep; +static ID id_close; + static ID id_block; static ID id_unblock; + +static ID id_kernel_sleep; + static ID id_io_read; static ID id_io_write; static ID id_io_wait; @@ -21,14 +25,23 @@ static ID id_io_wait; void Init_Scheduler(void) { - id_kernel_sleep = rb_intern_const("kernel_sleep"); + id_close = rb_intern_const("close"); + id_block = rb_intern_const("block"); id_unblock = rb_intern_const("unblock"); + + id_kernel_sleep = rb_intern_const("kernel_sleep"); + id_io_read = rb_intern_const("io_read"); id_io_write = rb_intern_const("io_write"); id_io_wait = rb_intern_const("io_wait"); } +VALUE rb_scheduler_close(VALUE scheduler) +{ + return rb_funcall(scheduler, id_close, 0); +} + VALUE rb_scheduler_timeout(struct timeval *timeout) { if (timeout) { |