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



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

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

Instance Method Details

#start!Object



238
239
240
241
242
243
244
245
246
247
# File 'lib/puma/thread_pool.rb', line 238

def start!
  @running = true

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

#stopObject



249
250
251
252
# File 'lib/puma/thread_pool.rb', line 249

def stop
  @running = false
  @thread.wakeup
end