Skip to content
class method

Fiber.set_scheduler

(untyped) -> untyped
Fiber.set_scheduler(scheduler) → scheduler

Sets the Fiber scheduler for the current thread. If the scheduler is set, non-blocking fibers (created by Fiber.new with blocking: false, or by Fiber.schedule) call that scheduler’s hook methods on potentially blocking operations, and the current thread will call scheduler’s close method on finalization (allowing the scheduler to properly manage all non-finished fibers).

scheduler can be an object of any class corresponding to Fiber::Scheduler. Its implementation is up to the user.

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

Ruby version changes

  1. 3.0
See also .scheduler .yield .schedule #alive? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0