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.



273
274
275
276
277
# File 'lib/puma/thread_pool.rb', line 273

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

Instance Method Details

#start!Object



279
280
281
282
283
284
285
286
287
288
# File 'lib/puma/thread_pool.rb', line 279

def start!
  @running = true

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

#stopObject



290
291
292
293
# File 'lib/puma/thread_pool.rb', line 290

def stop
  @running = false
  @thread.wakeup
end