Method: BetterCap::Proxy::ThreadPool#trim
- Defined in:
- lib/bettercap/proxy/thread_pool.rb
#trim(force = false) ⇒ Object
If too many threads are in the pool, tell one to finish go ahead and exit. If force is true, then a trim request is requested even if all threads are being utilized.
152 153 154 155 156 157 158 159 |
# File 'lib/bettercap/proxy/thread_pool.rb', line 152 def trim(force=false) @mutex.synchronize do if (force or @waiting > 0) and @spawned - @trim_requested > @min @trim_requested += 1 @not_empty.signal end end end |