class Async::Barrier
A barrier is used to synchronize multiple tasks, waiting for them all to complete before continuing.
def async(*arguments, parent: (@parent or Task.current), **options, &block)
def async(*arguments, parent: (@parent or Task.current), **options, &block) task = parent.async(*arguments, **options, &block) @tasks << task return task end
def empty?
def empty? @tasks.empty? end
def initialize(parent: nil)
def initialize(parent: nil) @tasks = [] @parent = parent end
def size
def size @tasks.size end
def wait
def wait while task = @tasks.shift task.wait end end