class Async::Scheduler
def run_loop(&block)
def run_loop(&block) pt = nil heory, we could use Exception here to be a little bit safer, but we've only shown the case for SignalException to be a problem, so let's not over-engineer this. .handle_interrupt(::SignalException => :never) do self.interrupted? we are finished, we need to exit: k unless yield Interrupt => interrupt n interrupt did occur during an iteration of the event loop, we need to handle it. More specifically, `self.stop` is not safe to interrupt without potentially corrupting the task tree. .handle_interrupt(::SignalException => :never) do le.debug(self) do |buffer| er.puts "Scheduler interrupted: #{interrupt.inspect}" .print_hierarchy(buffer) stop e event loop was interrupted, and we finished exiting normally (due to the interrupt), we need to re-raise the interrupt so that the caller can handle it too. rrupt .raise(interrupt)