lib/quack_concurrency/condition_variable.rb
def wait(mutex, timeout = nil)
      validate_mutex(mutex)
      validate_timeout(timeout)
      waitable = waitable_for_current_thread
      @mutex.synchronize do
        @waitables.push(waitable)
        @waitables_to_resume.push(waitable)
      end
      waitable.wait(mutex, timeout)
      self
    end
def wait(mutex, timeout = nil)
      validate_mutex(mutex)
      validate_timeout(timeout)
      waitable = waitable_for_current_thread
      @mutex.synchronize do
        @waitables.push(waitable)
        @waitables_to_resume.push(waitable)
      end
      waitable.wait(mutex, timeout)
      self
    end
def wait ( mutex , timeout = nil ) validate_mutex ( mutex ) validate_timeout ( timeout ) waitable = waitable_for_current_thread @mutex . synchronize do @waitables . push ( waitable ) @waitables_to_resume . push ( waitable ) end waitable . wait ( mutex , timeout ) self end
Puts this thread to sleep until another thread resumes it.
 Threads will be woken in the chronological order that this was called.
 @note Will block until resumed
 @param mutex [Mutex] mutex to be unlocked while this thread is sleeping
 @param timeout [nil,Numeric] maximum time to sleep in seconds, +nil+ for forever
 @raise [TypeError] if +timeout+ is not +nil+ or +Numeric+
 @raise [ArgumentError] if +timeout+ is negative
 @raise [Exception] any exception raised by +::ConditionVariable#wait+ (eg. interrupts, +ThreadError+)
 @return [self]
Puts this thread to sleep until another thread resumes it . Threads will be woken in the chronological order that this was called .