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.
183 184 185 186 187 |
# File 'lib/puma/thread_pool.rb', line 183 def initialize(pool, timeout) @pool = pool @timeout = timeout @running = false end |
Instance Method Details
#start! ⇒ Object
189 190 191 192 193 194 195 196 197 198 |
# File 'lib/puma/thread_pool.rb', line 189 def start! @running = true @thread = Thread.new do while @running @pool.trim sleep @timeout end end end |
#stop ⇒ Object
200 201 202 203 |
# File 'lib/puma/thread_pool.rb', line 200 def stop @running = false @thread.wakeup end |