diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-08-01 06:49:07 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-01 06:49:07 +0900 |
commit | 3b52230452980f3afc6a7380276ea62f7c65e517 (patch) | |
tree | 51b1529d7a8897be325545d532e2f317f1dc0241 /ext/-test-/thread_fd/thread_fd.c | |
parent | 242f024bcbff6c46edd84a03365fa99ebd8eb524 (diff) | |
download | ruby-3b52230452980f3afc6a7380276ea62f7c65e517.tar.gz |
Define functions using rb_wait_for_single_fd [Bug #18046]
Diffstat (limited to 'ext/-test-/thread_fd/thread_fd.c')
-rw-r--r-- | ext/-test-/thread_fd/thread_fd.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/-test-/thread_fd/thread_fd.c b/ext/-test-/thread_fd/thread_fd.c index 3d3ec8a2e0..042b799dc8 100644 --- a/ext/-test-/thread_fd/thread_fd.c +++ b/ext/-test-/thread_fd/thread_fd.c @@ -7,8 +7,24 @@ thread_fd_close(VALUE ign, VALUE fd) return Qnil; } +static VALUE +thread_fd_wait(VALUE ign, VALUE fd) +{ + int ret = rb_thread_wait_fd(NUM2INT(fd)); + return INT2NUM(ret); +} + +static VALUE +thread_fd_writable(VALUE ign, VALUE fd) +{ + int ret = rb_thread_fd_writable(NUM2INT(fd)); + return INT2NUM(ret); +} + void Init_thread_fd(void) { rb_define_singleton_method(rb_cIO, "thread_fd_close", thread_fd_close, 1); + rb_define_singleton_method(rb_cIO, "thread_fd_wait", thread_fd_wait, 1); + rb_define_singleton_method(rb_cIO, "thread_fd_writable", thread_fd_writable, 1); } |