class Tochtli::BaseController::Dispatcher::ProcessCounter

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/tochtli/base_controller.rb, line 307
def initialize
  super
  @count = 0
  @cv    = new_cond
end

Public Instance Methods

decrement() click to toggle source
# File lib/tochtli/base_controller.rb, line 319
def decrement
  synchronize do
    @count -= 1 if @count > 0
    @cv.signal if @count == 0
  end
end
increment() click to toggle source
# File lib/tochtli/base_controller.rb, line 313
def increment
  synchronize do
    @count += 1
  end
end
wait(timeout) click to toggle source
# File lib/tochtli/base_controller.rb, line 326
def wait(timeout)
  synchronize do
    @cv.wait(timeout) unless @count == 0
  end
end