instance method
IO#wait_writable
(?::Time::_Timeout? timeout) -> ::boolish
io.wait_writable → truthy or falsy
io.wait_writable(timeout) → truthy or falsy
io.c
View on GitHub ↗
static VALUE
io_wait_writable(int argc, VALUE *argv, VALUE io)
{
rb_io_t *fptr;
RB_IO_POINTER(io, fptr);
rb_io_check_writable(fptr);
rb_check_arity(argc, 0, 1);
VALUE timeout = (argc == 1 ? argv[0] : Qnil);
return io_wait_event(io, RUBY_IO_WRITABLE, timeout, 1);
}
Waits until IO is writable and returns a truthy value or a falsy value when times out.
Ruby version changes
-
3.0
-
IO#wait_readable,IO#wait_writable,IO#read,IO#writeand other related methods (e.g.IO#puts,IO#gets) may invoke the scheduler hook io_wait(io, events, timeout) in a non-blocking execution context. [Feature #16786]
-