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.
139 140 141 142 143 |
# File 'lib/puma/thread_pool.rb', line 139 def initialize(pool, timeout) @pool = pool @timeout = timeout @running = false end |
Instance Method Details
#start! ⇒ Object
145 146 147 148 149 150 151 152 153 154 |
# File 'lib/puma/thread_pool.rb', line 145 def start! @running = true @thread = Thread.new do while @running @pool.trim sleep @timeout end end end |
#stop ⇒ Object
156 157 158 159 |
# File 'lib/puma/thread_pool.rb', line 156 def stop @running = false @thread.wakeup end |