Method: Concurrent::Async#async

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

#asyncConcurrent::IVar Also known as: cast

Note:

The method call is guaranteed to be thread safe with respect to all other method calls against the same object that are called with either ‘async` or `await`. The mutable nature of Ruby references (and object orientation in general) prevent any other thread safety guarantees. Do NOT mix direct method calls with delegated method calls. Use only delegated method calls when sharing the object between threads.

Causes the chained method call to be performed asynchronously on the object’s thread. The delegated method will return a future in the ‘:pending` state and the method call will have been scheduled on the object’s thread. The final disposition of the method call can be obtained by inspecting the returned future.

Returns:

Raises:

  • (NameError)

    the object does not respond to the requested method

  • (ArgumentError)

    the given ‘args` do not match the arity of the requested method



412
413
414
# File 'lib/concurrent-ruby/concurrent/async.rb', line 412

def async
  @__async_delegator__
end