summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-08-01 06:49:07 +0900
committerGitHub <noreply@github.com>2021-08-01 06:49:07 +0900
commit3b52230452980f3afc6a7380276ea62f7c65e517 (patch)
tree51b1529d7a8897be325545d532e2f317f1dc0241 /io.c
parent242f024bcbff6c46edd84a03365fa99ebd8eb524 (diff)
Define functions using rb_wait_for_single_fd [Bug #18046]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4696 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'io.c')
-rw-r--r--io.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/io.c b/io.c
index 2199c1aeaa..16f2526e95 100644
--- a/io.c
+++ b/io.c
@@ -1408,6 +1408,18 @@ rb_wait_for_single_fd(int fd, int events, struct timeval *timeout)
return io_wait_for_single_fd(fd, events, timeout);
}
+int
+rb_thread_wait_fd(int fd)
+{
+ return rb_wait_for_single_fd(fd, RUBY_IO_READABLE, NULL);
+}
+
+int
+rb_thread_fd_writable(int fd)
+{
+ return rb_wait_for_single_fd(fd, RUBY_IO_WRITABLE, NULL);
+}
+
VALUE rb_io_maybe_wait(int error, VALUE io, VALUE events, VALUE timeout)
{
switch (error) {