lib/quack_concurrency/safe_sleeper.rb
def wait(deadline)
      loop do
        if deadline
          remaining = deadline - Time.now
          @condition_variable.wait(@mutex, remaining) if remaining > 0
        else
          @condition_variable.wait(@mutex)
        end
        break if @state == :complete
        break if deadline && Time.now >= deadline
      end
    end
def wait(deadline)
      loop do
        if deadline
          remaining = deadline - Time.now
          @condition_variable.wait(@mutex, remaining) if remaining > 0
        else
          @condition_variable.wait(@mutex)
        end
        break if @state == :complete
        break if deadline && Time.now >= deadline
      end
    end
def wait ( deadline ) loop do if deadline remaining = deadline - Time . now @condition_variable . wait ( @mutex , remaining ) if remaining > 0 else @condition_variable . wait ( @mutex ) end break if @state == :complete break if deadline && Time . now >= deadline end end
Put this thread to sleep and wait for it to be woken.
 Will wake if {#wake} is called.
 If called with a +deadline+ it will wake when +deadline+ is reached.
 @api private
 @param deadline [nil,Time] maximum time to sleep, +nil+ for forever
 @raise [Exception] any exception raised by +ConditionVariable#wait+ (eg. interrupts, +ThreadError+)
 @return [void]
Put this thread to sleep and wait for it to be woken . Will wake if { #wake } is called . If called with a + deadline + it will wake when + deadline + is reached .