Method: Async::Waiter#async

Defined in:
lib/async/waiter.rb

#async(parent: (@parent or Task.current), **options, &block) ⇒ Object

Execute a child task and add it to the waiter.



28
29
30
31
32
33
34
35
# File 'lib/async/waiter.rb', line 28

def async(parent: (@parent or Task.current), **options, &block)
  parent.async(**options) do |task|
    yield(task)
  ensure
    @done << task
    @finished.signal
  end
end