Class: DatTCP::Worker
- Inherits:
-
Object
- Object
- DatTCP::Worker
- Defined in:
- lib/dat-tcp/worker_pool.rb
Instance Method Summary collapse
-
#initialize(pool, queue, workers_waiting, &block) ⇒ Worker
constructor
A new instance of Worker.
- #join ⇒ Object
- #shutdown ⇒ Object
Constructor Details
#initialize(pool, queue, workers_waiting, &block) ⇒ Worker
Returns a new instance of Worker.
165 166 167 168 169 170 171 172 |
# File 'lib/dat-tcp/worker_pool.rb', line 165 def initialize(pool, queue, workers_waiting, &block) @pool = pool @queue = queue @workers_waiting = workers_waiting @block = block @shutdown = false @thread = Thread.new{ work_loop } end |
Instance Method Details
#join ⇒ Object
178 179 180 |
# File 'lib/dat-tcp/worker_pool.rb', line 178 def join @thread.join if @thread end |
#shutdown ⇒ Object
174 175 176 |
# File 'lib/dat-tcp/worker_pool.rb', line 174 def shutdown @shutdown = true end |