123456789_123456789_123456789_123456789_123456789_

Class: Puma::ThreadPool::Reaper

Relationships & Source Files
Inherits: Object
Defined in: lib/puma/thread_pool.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(pool, timeout) ⇒ Reaper

[ GitHub ]

  
# File 'lib/puma/thread_pool.rb', line 273

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

Instance Method Details

#start!

[ GitHub ]

  
# 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

#stop

[ GitHub ]

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

def stop
  @running = false
  @thread.wakeup
end