Method: Fiber.set_scheduler

Defined in:
cont.c

.set_scheduler(scheduler) ⇒ Object

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.



2421
2422
2423
2424
2425
# File 'cont.c', line 2421

static VALUE
rb_fiber_set_scheduler(VALUE klass, VALUE scheduler)
{
    return rb_fiber_scheduler_set(scheduler);
}