This module contains default kgio_wait_readable and kgio_wait_writable methods that block indefinitely (in a thread-safe manner) until an IO object is read or writable. This module is included in the Kgio::PipeMethods and Kgio::SocketMethods modules used by all bundled IO-derived objects.
Blocks the running Thread indefinitely until self IO object is readable. This method is automatically called by default whenever kgio_read needs to block on input.
Users of alternative threading/fiber libraries are encouraged to override this method in their subclasses or modules to work with their threading/blocking methods.
static VALUE kgio_wait_readable(VALUE self)
{
int fd = my_fileno(self);
errno = EAGAIN;
if (!rb_io_wait_readable(fd))
rb_sys_fail("kgio_wait_readable");
return self;
}
Blocks the running Thread indefinitely until self IO object is writable. This method is automatically called whenever kgio_write needs to block on output.
Users of alternative threading/fiber libraries are encouraged to override this method in their subclasses or modules to work with their threading/blocking methods.
static VALUE kgio_wait_writable(VALUE self)
{
int fd = my_fileno(self);
errno = EAGAIN;
if (!rb_io_wait_writable(fd))
rb_sys_fail("kgio_wait_writable");
return self;
}
Generated with the Darkfish Rdoc Generator 2.