lib/griffin/thread_pool.rb in griffin-0.2.0 vs lib/griffin/thread_pool.rb in griffin-0.2.1
- old
+ new
@@ -39,9 +39,13 @@
if @mutex.synchronize { (@waiting < @tasks.size) && (@spawned < @max_pool_size) }
spawn_thread
end
end
+ def resouce_available?
+ (@waiting != 0) || (@spawned != @max_pool_size)
+ end
+
def shutdown
@shutdown = true
@max_pool_size.times { @tasks.push(nil) }
@auto_trimmer.stop
until @workers.empty?