class HTTPClient::TimeoutScheduler::Period

Represents timeout period.

def cancel

Cancel this Period. Mutex is needed to avoid too-late exception.
def cancel
  @lock.synchronize do
    @thread = nil
  end
end

def initialize(thread, time, ex)

Creates new Period.
def initialize(thread, time, ex)
  @thread, @time, @ex = thread, time, ex
  @lock = Mutex.new
end

def raise(message)

Raises if thread exists and alive.
def raise(message)
  @lock.synchronize do
    if @thread and @thread.alive?
      @thread.raise(@ex, message)
    end
  end
end