method
wait_writable
v2_2_9 -
Show latest stable
- Class:
IO
wait_writable(p1 = v1)public
Waits until IO writable is available or times out and returns self or nil when EOF is reached.
static VALUE
io_wait_writable(int argc, VALUE *argv, VALUE io)
{
rb_io_t *fptr;
int i;
VALUE timeout;
struct timeval timerec;
struct timeval *tv;
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
rb_scan_args(argc, argv, "01", &timeout);
if (NIL_P(timeout)) {
tv = NULL;
}
else {
timerec = rb_time_interval(timeout);
tv = &timerec;
}
i = rb_wait_for_single_fd(fptr->fd, RB_WAITFD_OUT, tv);
if (i < 0)
rb_sys_fail(0);
rb_io_check_closed(fptr);
if (i & RB_WAITFD_OUT)
return io;
return Qnil;
} Related methods
- Instance methods
- <<
- advise
- autoclose=
- autoclose?
- binmode
- binmode?
- bytes
- chars
- close
- close_on_exec=
- close_on_exec?
- close_read
- close_write
- closed?
- codepoints
- cooked
- cooked!
- each
- each_byte
- each_char
- each_codepoint
- each_line
- echo=
- echo?
- eof
- eof?
- expect
- external_encoding
- fcntl
- fdatasync
- fileno
- flush
- fsync
- getbyte
- getc
- getch
- gets
- iflush
- initialize_copy
- inspect
- internal_encoding
- ioctl
- ioflush
- isatty
- lineno
- lineno=
- lines
- noecho
- nonblock
- nonblock=
- nonblock?
- nread
- oflush
- pathconf
- pid
- pos
- pos=
- printf
- putc
- puts
- raw
- raw!
- read
- read_nonblock
- readbyte
- readchar
- readline
- readlines
- readpartial
- ready?
- reopen
- rewind
- scanf
- seek
- set_encoding
- stat
- sync
- sync=
- sysread
- sysseek
- syswrite
- tell
- to_i
- to_io
- tty?
- ungetbyte
- ungetc
- wait
- wait_readable
- wait_writable
- winsize
- winsize=
- write
- write_nonblock
- Class methods
- binread
- binwrite
- console
- copy_stream
- for_fd
- foreach
- new
- open
- pipe
- popen
- read
- readlines
- select
- sysopen
- try_convert
- write
- Private methods
-
block_scanf -
soak_up_spaces