def wait_for(interests, opts={})

      @waiting << [ Thread.current, interests ]

      Thread.current['__result__'] = nil
      start = Time.now

      to = opts[:timeout] || @timeout
      to = nil if to.nil? || to <= 0

      loop do

        raise(
          Ruote::LoggerTimeout.new(interests, to)
        ) if to && (Time.now - start) > to

        @mutex.synchronize { check_waiting }

        break if Thread.current['__result__']

        sleep 0.007
      end

      Thread.current['__result__']
    end
def wait_for(interests, opts={})

      @waiting << [ Thread.current, interests ]

      Thread.current['__result__'] = nil
      start = Time.now

      to = opts[:timeout] || @timeout
      to = nil if to.nil? || to <= 0

      loop do

        raise(
          Ruote::LoggerTimeout.new(interests, to)
        ) if to && (Time.now - start) > to

        @mutex.synchronize { check_waiting }

        break if Thread.current['__result__']

        sleep 0.007
      end

      Thread.current['__result__']
    end
Blocks until one or more interests are satisfied.

 interests must be an array of interests. Please refer to
 Dashboard#wait_for documentation for allowed values of each interest.

 If multiple interests are given, wait_for blocks until
 all of the interests are satisfied.

 wait_for may only be used by one thread at a time. If one
 thread calls wait_for and later another thread calls wait_for
 while the first thread is waiting, the first thread's
 interests are lost and the first thread will never wake up.