module Await

Public Instance Methods

await(&block) click to toggle source

Define a group of operations that need to be completed before execution will continue. The current fiber is suspended until all of the defer operations have completed.

# File lib/await.rb, line 73
def await(&block)
  Thread.current.await(&block)
end
defer(*args, &block) click to toggle source

Used to define a deferred operation. The return value is a Proc that can be passed through as a callback argument to any method. Once the callback has been executed it is considered complete unless within that callback other defer or await calls are made.

# File lib/await.rb, line 81
def defer(*args, &block)
  Thread.current.defer(*args, &block)
end