Resource pool shared state (internal usage).
More...
#include <resourcePool.hpp>
Resource pool shared state (internal usage).
State shared between ResourcePool and its borrowed PoolableResource.
It is kept alive by borrowed resources: a resource can be released after its pool destruction.
Every member is protected by _mutex.
- Author
- Vincent Lachenal
- Since
- 0.1
◆ notifyFirstWaiter()
Wake up the first waiting borrower (_mutex has to be locked)
◆ release()
Release a borrowed resource slot.
Valid resource is pushed back in pool (unless the pool has been destroyed) ; invalid one is destroyed.
Resources are destroyed outside the lock.
- Parameters
-
| res | the resource (can be nullptr when its creation has failed) |
| valid | true if the resource can be reused, false otherwise |
◆ _availables
◆ _closed
true when the pool has been destroyed
◆ _mutex
◆ _used
Number of borrowed resources (including resources which are being created)
◆ _waiters
Borrowers waiting for a resource, in arrival order: each one waits on its own condition variable and only the first one is woken up (borrowers are served in FIFO order)
The documentation for this struct was generated from the following file: