# File lib/logging/stats.rb, line 235
    def periodically_run( period, &block )
      raise ArgumentError, 'a runner already exists' unless @runner.nil?

      @runner = Thread.new do
        start = stop = Time.now.to_f
        loop do
          seconds = period - (stop-start)
          seconds = period if seconds <= 0
          sleep seconds

          start = Time.now.to_f
          break if Thread.current[:stop] == true
          if @mutex then @mutex.synchronize(&block)
          else block.call end
          stop = Time.now.to_f
        end
      end
    end