def sleep(timeout = nil)
      timer do |start_time|
        deadline = wake_deadline(start_time, timeout)
        enforce_sleep_call_limit
        @mutex.synchronize do
          break if @state == :complete
          @state == :sleep
          wait(deadline)
        ensure
          @state = :complete
        end
      end
    end
def sleep(timeout = nil)
      timer do |start_time|
        deadline = wake_deadline(start_time, timeout)
        enforce_sleep_call_limit
        @mutex.synchronize do
          break if @state == :complete
          @state == :sleep
          wait(deadline)
        ensure
          @state = :complete
        end
      end
    end
Creates a new {SafeSleeper} concurrency tool.
 @return [SafeSleeper]
 @see SafeSleeper#sleep