Class: Puma::ThreadPool::Reaper

Inherits:
Object
  • Object
show all
Defined in:
lib/puma/thread_pool.rb

Instance Method Summary collapse

Constructor Details

#initialize(pool, timeout) ⇒ Reaper

Returns a new instance of Reaper.



215
216
217
218
219
# File 'lib/puma/thread_pool.rb', line 215

def initialize(pool, timeout)
  @pool = pool
  @timeout = timeout
  @running = false
end

Instance Method Details

#start!Object



221
222
223
224
225
226
227
228
229
230
# File 'lib/puma/thread_pool.rb', line 221

def start!
  @running = true

  @thread = Thread.new do
    while @running
      @pool.reap
      sleep @timeout
    end
  end
end

#stopObject



232
233
234
235
# File 'lib/puma/thread_pool.rb', line 232

def stop
  @running = false
  @thread.wakeup
end