Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Fiber::Scheduler#fiber

fiber(&block)

Implementation of the Fiber.schedule. The method is expected to immediately run the given block of code in a separate non-blocking fiber, and to return that Fiber.

Minimal suggested implementation is:

Example
def fiber(&block)
  fiber = Fiber.new(blocking: false, &block)
  fiber.resume
  fiber
end
See also #close #io_pread #block #io_pwrite also in 4.1 · 4.0 · 3.4 · 3.3