class Seahorse::Client::AsyncResponse

def wait

def wait
  if error && context.config.raise_response_errors
    raise error
  elsif @stream
    # have a sync signal that #signal can be blocked on
    # else, if #signal is called before #wait
    # will be waiting for a signal never arrives
    @sync_queue << "sync_signal"
    # now #signal is unlocked for
    # signaling close condition when ready
    @stream_mutex.synchronize {
      @close_condition.wait(@stream_mutex)
    }
    @response
  end
end