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.
244 245 246 247 248 |
# File 'lib/puma/thread_pool.rb', line 244 def initialize(pool, timeout) @pool = pool @timeout = timeout @running = false end |
Instance Method Details
#start! ⇒ Object
250 251 252 253 254 255 256 257 258 259 |
# File 'lib/puma/thread_pool.rb', line 250 def start! @running = true @thread = Thread.new do while @running @pool.trim sleep @timeout end end end |
#stop ⇒ Object
261 262 263 264 |
# File 'lib/puma/thread_pool.rb', line 261 def stop @running = false @thread.wakeup end |