class Async::Pool::Controller
def acquire_existing_resource
Acquire an existing resource with zero usage.
def acquire_existing_resource while @resources.any? @resources.each do |resource, usage| if usage == 0 return resource end end @notification.wait end # Only when the pool has been completely drained, return nil: return nil end