Method: Async::Scheduler#initialize
- Defined in:
- lib/async/scheduler.rb
#initialize(parent = nil, selector: nil, profiler: Profiler&.default, worker_pool: WORKER_POOL) ⇒ Scheduler
Create a new scheduler.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/async/scheduler.rb', line 53 def initialize(parent = nil, selector: nil, profiler: Profiler&.default, worker_pool: WORKER_POOL) super(parent) @selector = selector || ::IO::Event::Selector.new(Fiber.current) @profiler = profiler @interrupted = false @blocked = 0 @busy_time = 0.0 @idle_time = 0.0 @timers = ::IO::Event::Timers.new if worker_pool == true @worker_pool = WorkerPool.new else @worker_pool = worker_pool end if @worker_pool self.singleton_class.prepend(WorkerPool::BlockingOperationWait) end end |