class Async::Scheduler
def async(*arguments, **options, &block)
- With no replacement.
def async(*arguments, **options, &block) Kernel.raise ClosedError if @selector.nil? task = Task.new(Task.current? || self, **options, &block) # I want to take a moment to explain the logic of this. # When calling an async block, we deterministically execute it until the # first blocking operation. We don't *have* to do this - we could schedule # it for later execution, but it's useful to: # - Fail at the point of the method call where possible. # - Execute determinstically where possible. # - Avoid scheduler overhead if no blocking operation is performed. task.run(*arguments) # Console.debug "Initial execution of task #{fiber} complete (#{result} -> #{fiber.alive?})..." return task end