class Archfiend::ThreadLoop

Constants

EXCEPTION_DELAY

Attributes

subclasses[R]
app[RW]

Public Class Methods

inherited(child_class) click to toggle source

Collects all subclasses in the class instance variable

# File lib/archfiend/thread_loop.rb, line 16
def inherited(child_class)
  @subclasses ||= []
  @subclasses.push(child_class)
end
start_all(app) click to toggle source
# File lib/archfiend/thread_loop.rb, line 21
def start_all(app)
  (subclasses || []).map do |thread_loop_class|
    th = Thread.new do
      instance = thread_loop_class.new
      instance.app = app
      app.logger.info "Starting thread #{thread_loop_class}"
      instance.run
    end
    th[:name] = thread_loop_class.name
    th
  end
end