class Async::Scheduler
def close
Terminate all child tasks and close the scheduler.
def close unless @children.nil? self.run_loop do until self.terminate self.run_once! end end end Kernel.raise "Closing scheduler with blocked operations!" if @blocked > 0 ensure # We want `@selector = nil` to be a visible side effect from this point forward, specifically in `#interrupt` and `#unblock`. If the selector is closed, then we don't want to push any fibers to it. if selector = @selector @selector = nil selector.close end if worker_pool = @worker_pool @worker_pool = nil worker_pool.close end consume end