|
dispenso 1.4.1
A library for task parallelism
|
#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 77 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 87 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 125 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 113 of file resource_pool.h.
|
friend |
Definition at line 146 of file resource_pool.h.