Method: Concurrent::Agent.await

Defined in:
lib/concurrent-ruby/concurrent/agent.rb

.await(*agents) ⇒ Boolean

Blocks the current thread (indefinitely!) until all actions dispatched thus far to all the given Agents, from this thread or nested by the given Agents, have occurred. Will block when any of the agents are failed. Will never return if a failed Agent is restart with :clear_actions true.

NOTE Never, *under any circumstances*, call any of the “await” methods (#await, #await_for, #await_for!, and #wait) from within an action block/proc/lambda. The call will block the Agent and will always fail. Calling either #await or #wait (with a timeout of nil) will hopelessly deadlock the Agent with no possibility of recovery.

Parameters:

Returns:

  • (Boolean)

    true



449
450
451
452
# File 'lib/concurrent-ruby/concurrent/agent.rb', line 449

def await(*agents)
  agents.each { |agent| agent.await }
  true
end