Sha256: 186bd17a0bb65ef6d3999d21be37728c21434f947130fed6a52bfba150060f0a
Contents?: true
Size: 504 Bytes
Versions: 5
Compression:
Stored size: 504 Bytes
Contents
class QueueWorker PAUSE_DURATION = 1 def initialize(queue, stats_thread) @stats_thread = stats_thread @queue = queue run end def run @running = true @thread = Thread.new do while @running task = @queue.pop sleep(PAUSE_DURATION) and next if task.nil? task.execute @stats_thread.processed_task end end end def stop @running = false end def kill @thread.kill end def join @thread.join end end
Version data entries
5 entries across 5 versions & 1 rubygems