Method
Pool::borrow
Lends an instance to the caller until it calls release() or discard(), and waits while all are out.
Description#
public Pool::borrow(
float $timeout = PHP_FLOAT_MAX
): objectParameters#
- $timeout float = PHP_FLOAT_MAX
- Seconds to wait for an instance at most
Return values#
An instance that no other coroutine has object
Errors / Exceptions#
| Exception | When |
|---|---|
TimeoutException | If no instance became free in time |
Throwable | What $create threw |
See also#
Pool::useRuns$fnwith an instance of its own, and releases the instance afterwards, also when$fnthrows.Pool::releaseGives a borrowed instance back, for the next borrower.