class Concurrent::Event

def wait(timeout = nil)

Returns:
  • (Boolean) - true if the `Event` was set before timeout else false
def wait(timeout = nil)
  @mutex.lock
  unless @set
    remaining = Condition::Result.new(timeout)
    while !@set && remaining.can_wait?
      remaining = @condition.wait(@mutex, remaining.remaining_time)
    end
  end
  result = @set
  @mutex.unlock
  result
end