Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
Fiber::Scheduler#io_write
VALUE
rb_fiber_scheduler_io_write(VALUE scheduler, VALUE io, VALUE buffer, size_t offset, size_t length)
{
if (!rb_respond_to(scheduler, id_io_write)) {
return RUBY_Qundef;
}
VALUE arguments[] = {
scheduler, io, buffer, SIZET2NUM(offset), SIZET2NUM(length)
};
return rb_thread_io_blocking_operation(io, fiber_scheduler_io_write, (VALUE)&arguments);
}
Invoked by IO#write or IO::Buffer#write to perform one write of at most length bytes to io from a specified buffer (see IO::Buffer), starting at the given offset.
A short write is returned directly. Specifying a length of 0 returns 0 without performing a write.
The implementation should perform one non-blocking write and return -EAGAIN if io is not ready. The caller can then wait and retry as appropriate.
See IO::Buffer for an interface available to get data from buffer efficiently.
Expected to return number of bytes written, or, in case of an error, -errno (negated number corresponding to system’s error code).
Ruby version changes
-
4.0
-
Invoke
Fiber::Scheduler#io_writewhen flushing theIOwrite buffer. [Bug #21789]
-