The make-pool function returns a new resource pool that lazily creates new resources using make-resource. The resulting pool can contain up to #:max-size resources.
The #:idle-ttl argument controls how long a resource can remain idle before destroy-resource is applied to it and it is removed from the pool.
(call-with-pool-resource p f #:timeout timeout) → any/c p : pool? f : (-> any/c any) timeout : (or/c #f exact-nonnegative-integer?)
Leases a resource from p and applies f to it, returning the leased value back into the pool once f finishes executing.
p : pool? timeout : (or/c #f exact-nonnegative-integer?) = #f
Waits for a resource to become available and then leases it from p. If the timeout argument is provided, the function will block for at most timeout milliseconds before returning. On timeout, #f is returned.
Releases v back into p. If v was not leased from p, then an exn:fail:pool? error is raised.
Closes p. If pool-close is called before all of the leased resources have been returned to the pool, an exn:fail:pool? error is raised and the pool remains open.
Raises an error if p has already been closed.
Returns #t when v is a resource pool error.