Skip to content

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

class method

Fiber.blocking?

Fiber.blocking? → false or 1

Returns false if the current fiber is non-blocking. Fiber is non-blocking if it was created via passing blocking: false to Fiber.new, or via Fiber.schedule.

If the current Fiber is blocking, the method returns 1. Future developments may allow for situations where larger integers could be returned.

Note that, even if the method returns false, Fiber behaves differently only if Fiber.scheduler is set in the current thread.

See the “Non-blocking fibers” section in class docs for details.

Ruby version changes

  1. 3.0
See also .blocking #blocking? .current .[]= also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0