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.
103 104 105 106 107 |
# File 'lib/puma/thread_pool.rb', line 103 def initialize(pool, timeout) @pool = pool @timeout = timeout @running = false end |
Instance Method Details
#start! ⇒ Object
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/puma/thread_pool.rb', line 109 def start! @running = true @thread = Thread.new do while @running @pool.trim sleep @timeout end end end |
#stop ⇒ Object
120 121 122 123 |
# File 'lib/puma/thread_pool.rb', line 120 def stop @running = false @thread.wakeup end |