Class: Farce::Scheduler
- Inherits:
-
Abstract::Scheduler
- Object
- Abstract::Executor
- Abstract::Scheduler
- Farce::Scheduler
- Includes:
- Farce::Shareable::Unfreezable
- Defined in:
- lib/farce/scheduler.rb
Overview
A Ractor-shareable task scheduler.
Tasks run as fibers using a fiber scheduler, or as threads when the Ruby implementation doesn't support Fiber schedulers (ie TruffleRuby).
It supports any existing Fiber scheduler, including Async and CarbonFiber, but can also be used as a Fiber scheduler itself.
Use Abstract::Scheduler.create to start a worker, or construct an instance and install it with
Fiber.set_scheduler on the current thread. A scheduler can only be launched
or installed once.
It will keep the fiber scheduler alive until it is explicitly closed.
Closing a scheduler stops new submissions through Abstract::Scheduler#schedule. The underlying
fiber scheduler has its own lifecycle: draining fibers may still spawn child
fibers with Fiber.schedule while it is closing.
Method Summary
Methods included from Shareable
#initialize, #ractor_shareable?
Methods inherited from Abstract::Scheduler
#alive?, #capacity, #capacity=, #close, #closed?, create, current, #error, #external_scheduler, #initialize, #launch, #launch_ractor, #launch_thread, #local?, #owner, #owner=, #schedule, #state, #try_schedule, #wraps_external?
Methods inherited from Abstract::Executor
#close, #close_all, #closed?, #error, #execute, #local?, #ractor_shareable?, #schedule, #state, #try_schedule