Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Fiber::Scheduler#io_write

io_write(io, buffer, offset, length) → written length or -errno

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

  1. 4.0