# File lib/httpclient/timeout.rb, line 63
    def register(thread, sec, ex)
      period = Period.new(thread, Time.now + sec, ex || ::Timeout::Error)
      @pool[period] = true
      if @next.nil? or period.time < @next
        begin
          @thread.wakeup
        rescue ThreadError
          # Thread may be dead by fork.
          @thread = start_timer_thread
        end
      end
      period
    end