diff options
author | Samuel Williams <[email protected]> | 2024-10-04 20:35:57 +1300 |
---|---|---|
committer | <[email protected]> | 2024-10-04 07:35:57 +0000 |
commit | c33cb9a5867b0d35335a7d6921184a60356a32d7 () | |
tree | dadddf53fca3347309e5150bb7ac5ef6b4af0479 /spec/ruby/optional/capi/ext/io_spec.c | |
parent | c878843b2cb8fd54ebfaabd10b6334cf4d400208 (diff) |
Update `io_spec.c` to use `rb_io_maybe_wait*` if possible. (#11792)
Notes: Merged-By: ioquatix <[email protected]>
-rw-r--r-- | spec/ruby/optional/capi/ext/io_spec.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -143,7 +143,11 @@ VALUE io_spec_rb_io_wait_readable(VALUE self, VALUE io, VALUE read_p) { errno = saved_errno; } ret = rb_io_wait_readable(fd); if (RTEST(read_p)) { ssize_t r = read(fd, buf, RB_IO_WAIT_READABLE_BUF); @@ -162,7 +166,11 @@ VALUE io_spec_rb_io_wait_readable(VALUE self, VALUE io, VALUE read_p) { } VALUE io_spec_rb_io_wait_writable(VALUE self, VALUE io) { int ret = rb_io_wait_writable(io_spec_get_fd(io)); return ret ? Qtrue : Qfalse; } @@ -230,13 +238,23 @@ VALUE io_spec_rb_thread_wait_fd(VALUE self, VALUE io) { } VALUE io_spec_rb_wait_for_single_fd(VALUE self, VALUE io, VALUE events, VALUE secs, VALUE usecs) { - int fd = io_spec_get_fd(io); struct timeval tv; if (!NIL_P(secs)) { tv.tv_sec = FIX2INT(secs); tv.tv_usec = FIX2INT(usecs); } return INT2FIX(rb_wait_for_single_fd(fd, FIX2INT(events), NIL_P(secs) ? NULL : &tv)); } VALUE io_spec_rb_thread_fd_writable(VALUE self, VALUE io) { |