Class: Puma::ThreadPool::Reaper
- Inherits:
-
Object
- Object
- Puma::ThreadPool::Reaper
- Defined in:
- lib/puma/thread_pool.rb
Instance Method Summary collapse
-
#initialize(pool, timeout) ⇒ Reaper
constructor
A new instance of Reaper.
- #start! ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(pool, timeout) ⇒ Reaper
Returns a new instance of Reaper.
212 213 214 215 216 |
# File 'lib/puma/thread_pool.rb', line 212 def initialize(pool, timeout) @pool = pool @timeout = timeout @running = false end |
Instance Method Details
#start! ⇒ Object
218 219 220 221 222 223 224 225 226 227 |
# File 'lib/puma/thread_pool.rb', line 218 def start! @running = true @thread = Thread.new do while @running @pool.reap sleep @timeout end end end |
#stop ⇒ Object
229 230 231 232 |
# File 'lib/puma/thread_pool.rb', line 229 def stop @running = false @thread.wakeup end |