ucommon
|
Class for resource bound memory pools between threads. More...
#include <thread.h>
Protected Member Functions | |
ReusableObject * | next (ReusableObject *object) |
Get next reusable object in the pool. | |
void | release (ReusableObject *object) |
Release resuable object. | |
ReusableAllocator () | |
Initialize reusable allocator through a conditional. | |
Protected Attributes | |
ReusableObject * | freelist |
unsigned | waiting |
Class for resource bound memory pools between threads.
This is used to support a memory pool allocation scheme where a pool of reusable objects may be allocated, and the pool renewed by releasing objects or back. When the pool is used up, a pool consuming thread then must wait for a resource to be freed by another consumer (or timeout). This class is not meant to be used directly, but rather to build the synchronizing control between consumers which might be forced to wait for a resource.
ReusableAllocator::ReusableAllocator | ( | ) | [protected] |
Initialize reusable allocator through a conditional.
Zero free list.
ReusableObject* ReusableAllocator::next | ( | ReusableObject * | object | ) | [inline, protected] |
void ReusableAllocator::release | ( | ReusableObject * | object | ) | [protected] |
Release resuable object.
object | being released. |