class Async::Barrier
def wait
Wait for all tasks to complete by invoking {Task#wait} on each waiting task, which may raise an error. As long as the task has completed, it will be removed from the barrier.
def wait @tasks.each do |waiting| task = waiting.task begin task.wait ensure @tasks.remove?(waiting) unless task.alive? end end end