Method: Thread::Pool#trim
- Defined in:
- lib/thread/pool.rb
#trim(force = false) ⇒ Object
Trim the unused threads, if forced threads will be trimmed even if there are tasks waiting.
235 236 237 238 239 240 241 242 243 244 |
# File 'lib/thread/pool.rb', line 235 def trim (force = false) @mutex.synchronize { if (force || @waiting > 0) && @spawned - @trim_requests > @min @trim_requests += 1 @cond.signal end } self end |