class Contender::Pool::PoolWorker
Attributes
completed_task_count[R]
thread[R]
Public Class Methods
new(thread_factory, first_task)
click to toggle source
# File lib/contender/pool/pool_worker.rb, line 9 def initialize(thread_factory, first_task) @mutex = Mutex.new @thread_factory = thread_factory @first_task = first_task @completed_task_count = 0 end
Public Instance Methods
first_task!()
click to toggle source
# File lib/contender/pool/pool_worker.rb, line 17 def first_task! @first_task.tap { @first_task = nil } end
interrupt()
click to toggle source
# File lib/contender/pool/pool_worker.rb, line 31 def interrupt @thread.raise Interrupt end
on_task_completion()
click to toggle source
# File lib/contender/pool/pool_worker.rb, line 23 def on_task_completion @completed_task_count += 1 end
start(&worker_loop)
click to toggle source
# File lib/contender/pool/pool_worker.rb, line 27 def start(&worker_loop) @thread = @thread_factory.create &worker_loop end