instance method
Fiber::Scheduler#io_pread
io_pread(io, buffer, from, length, offset) → read length or -errno
scheduler.c
View on GitHub ↗
VALUE
rb_fiber_scheduler_io_pread(VALUE scheduler, VALUE io, rb_off_t from, VALUE buffer, size_t length, size_t offset)
{
if (!rb_respond_to(scheduler, id_io_pread)) {
return RUBY_Qundef;
}
VALUE arguments[] = {
scheduler, io, buffer, OFFT2NUM(from), SIZET2NUM(length), SIZET2NUM(offset)
};
if (rb_respond_to(scheduler, id_fiber_interrupt)) {
return rb_thread_io_blocking_operation(io, fiber_scheduler_io_pread, (VALUE)&arguments);
} else {
return fiber_scheduler_io_pread((VALUE)&arguments);
}
}
Invoked by IO#pread or IO::Buffer#pread to read length bytes from io at offset from into a specified buffer (see IO::Buffer) at the given offset.
This method is semantically the same as io_read, but it allows to specify the offset to read from and is often better for asynchronous IO on the same file.
The method should be considered experimental.