class Async::Reactor
def sleep(duration)
def sleep(duration) task = Fiber.current timer = self.after(duration) do if task.alive? task.resume end end Task.yield ensure timer.cancel if timer end
def sleep(duration) task = Fiber.current timer = self.after(duration) do if task.alive? task.resume end end Task.yield ensure timer.cancel if timer end