#include <resource_pool.h>
Public Member Functions | |
| template<typename F > | |
| ResourcePool (size_t size, const F &init) | |
| Resource< T > | acquire () |
| ~ResourcePool () | |
Friends | |
| class | Resource< T > |
A pool of resources that can be accessed from multiple threads. This is akin to a set of resources and a semaphore ensuring enough resources exist.
Definition at line 75 of file resource_pool.h.
|
inline |
Construct a ResourcePool.
| size | The number of T objects in the pool. |
| init | A functor with signature T() which can be called to initialize the pool's resources. |
Definition at line 85 of file resource_pool.h.
|
inline |
Destruct the ResourcePool. The user must ensure that all resources are returned to the pool prior to destroying the pool.
Definition at line 123 of file resource_pool.h.
|
inline |
Acquire a resource from the pool. This function may block until a resource becomes available.
Resource-wrapped resource. Definition at line 111 of file resource_pool.h.
|
friend |
Definition at line 144 of file resource_pool.h.