require_relative 'logger' module Remon class EventProcessor include Logger attr_reader :queue def initialize(pr) @proc = pr @queue = Queue.new end def start @thread ||= Thread.new do logger.debug { "starting event processor" } loop { process_event } end end def process_event event = @queue.pop @proc.call event rescue => e logger.warn "warn error #{e.message}" end def stop Thread.kill @thread if @thread end end end