Class: Puma::ThreadPool::AutoTrim
- Inherits:
-
Object
- Object
- Puma::ThreadPool::AutoTrim
- Defined in:
- lib/puma/thread_pool.rb
Instance Method Summary collapse
-
#initialize(pool, timeout) ⇒ AutoTrim
constructor
A new instance of AutoTrim.
- #start! ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(pool, timeout) ⇒ AutoTrim
Returns a new instance of AutoTrim.
189 190 191 192 193 |
# File 'lib/puma/thread_pool.rb', line 189 def initialize(pool, timeout) @pool = pool @timeout = timeout @running = false end |
Instance Method Details
#start! ⇒ Object
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/puma/thread_pool.rb', line 195 def start! @running = true @thread = Thread.new do while @running @pool.trim sleep @timeout end end end |
#stop ⇒ Object
206 207 208 209 |
# File 'lib/puma/thread_pool.rb', line 206 def stop @running = false @thread.wakeup end |