A reusable private pool of reusable types.
More...
#include <vector.h>
|
|
bool | avail (void) |
| |
|
ReusableObject * | get (void) |
| |
|
ReusableObject * | get (timeout_t timeout) |
| |
|
| PagerReuse (mempager *pager, size_t objsize, unsigned count) |
| |
|
ReusableObject * | request (void) |
| |
|
virtual void * | _alloc (size_t size) |
| |
|
| MemoryRedirect (MemoryProtocol *protocol) |
| |
| virtual void * | _alloc (size_t size)=0 |
| | Protocol to allocate memory from the pager heap. More...
|
| |
|
virtual void | fault (void) const |
| | Allocation failure handler.
|
| |
| void * | alloc (size_t size) |
| | Convenience function. More...
|
| |
| char * | dup (const char *string) |
| | Duplicate NULL terminated string into allocated memory. More...
|
| |
| void * | dup (void *memory, size_t size) |
| | Duplicate existing memory block into allocated memory. More...
|
| |
| void * | zalloc (size_t size) |
| | Allocate memory from the pager heap. More...
|
| |
| ReusableObject * | next (ReusableObject *object) |
| | Get next reusable object in the pool. More...
|
| |
| void | release (ReusableObject *object) |
| | Release resuable object. More...
|
| |
| | ReusableAllocator () |
| | Initialize reusable allocator through a conditional. More...
|
| |
|
void | broadcast (void) |
| | Signal the conditional to release all waiting threads.
|
| |
|
| Conditional () |
| | Initialize and construct conditional.
|
| |
|
void | lock (void) |
| | Lock the conditional's supporting mutex.
|
| |
|
void | signal (void) |
| | Signal the conditional to release one waiting thread.
|
| |
|
void | unlock (void) |
| | Unlock the conditional's supporting mutex.
|
| |
| bool | wait (timeout_t timeout) |
| | Conditional wait for signal on millisecond timeout. More...
|
| |
| bool | wait (struct timespec *timeout) |
| | Conditional wait for signal on timespec timeout. More...
|
| |
|
void | wait (void) |
| | Wait (block) until signalled.
|
| |
|
| ~Conditional () |
| | Destroy conditional, release any blocked threads.
|
| |
| static pthread_condattr_t * | initializer (void) |
| | Support function for getting conditional attributes for realtime scheduling. More...
|
| |
| static void | set (struct timespec *hires, timeout_t timeout) |
| | Convert a millisecond timeout into use for high resolution conditional timers. More...
|
| |
|
ReusableObject * | freelist |
| |
|
unsigned | waiting |
| |
template<class T>
class ucommon::paged_reuse< T >
A reusable private pool of reusable types.
A pool of typed objects is created which can be allocated from a memory pager. Deallocated typed objects are also returned to this pool so they can be reallocated later.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 595 of file vector.h.
Create a managed reusable typed object pool.
This manages a heap of typed objects that can either be reused from released objects or allocate from an existing memory pager pool.
- Parameters
-
| pager | pool to allocate from. |
| count | of objects of specified type to allocate. |
Definition at line 605 of file vector.h.
Get a typed object from the pager heap.
This function blocks when the heap is empty until an object is returned to the heap. The objects default constructor is used.
- Returns
- typed object pointer from heap.
Definition at line 636 of file vector.h.
Create a typed object from the heap.
This function blocks until the the heap has an object to return or the timer has expired. The objects default constructor is used.
- Parameters
-
| timeout | to wait for heap in milliseconds. |
- Returns
- typed object pointer from heap or NULL if timeout.
Definition at line 655 of file vector.h.
Get a typed object from the pager heap.
This function blocks when the heap is empty until an object is returned to the heap.
- Returns
- typed object pointer from heap.
Definition at line 627 of file vector.h.
Get a typed object from the heap.
This function blocks until the the heap has an object to return or the timer has expired.
- Parameters
-
| timeout | to wait for heap in milliseconds. |
- Returns
- typed object pointer from heap or NULL if timeout.
Definition at line 645 of file vector.h.
Test if typed objects available from the pager or re-use list.
- Returns
- true if objects still are available.
Definition at line 612 of file vector.h.
Get a typed object from the pager heap by pointer reference.
This function blocks while the heap is empty.
- Returns
- typed object pointer from heap.
Definition at line 685 of file vector.h.
Test if no objects are available for reuse or the pager.
- Returns
- true if no objects are available.
Definition at line 619 of file vector.h.
Get a typed object from the pager heap by type casting reference.
This function blocks while the heap is empty.
- Returns
- typed object pointer from heap.
Definition at line 677 of file vector.h.
Release (return) a typed object back to the pager heap for re-use.
- Parameters
-
Definition at line 669 of file vector.h.
Request immediately next available typed object from the pager heap.
- Returns
- typed object pointer or NULL if heap is empty.
Definition at line 662 of file vector.h.
The documentation for this class was generated from the following file: