lib/kernel/sync.rb in async-2.15.3 vs lib/kernel/sync.rb in async-2.16.0
- old
+ new
@@ -16,9 +16,11 @@
# @public Since `stable-v1`.
# @asynchronous Will block until given block completes executing.
def Sync(&block)
if task = ::Async::Task.current?
yield task
+ elsif scheduler = Fiber.scheduler
+ ::Async::Task.run(scheduler, &block).wait
else
# This calls Fiber.set_scheduler(self):
reactor = Async::Reactor.new
begin