Details
RecyclerCreate ()
recycler_t* RecyclerCreate (size_t ChunkSize,
unsigned int ChunksMax); |
Create a recycler.
It will be capable to handle ChunksMax elements of size ChunkSize bytes.
RecyclerDestroy ()
int RecyclerDestroy (recycler_t *Recycler,
int Force); |
Liberate the memory used by a recycler.
After this function return, the passed handle is invalid.
Force tell RecyclerDestroy() to free the recycler even if it
is not empty.
RecyclerGrow ()
int RecyclerGrow (recycler_t *Recycler,
unsigned int ChunksCount); |
Add ChunksCount new free elements to a recycler.
RecyclerShrink ()
int RecyclerShrink (recycler_t *Recycler,
unsigned int ChunksCount); |
Remove ChunksCount new free elements to a recycler.
Be carefull: the element returned by the last RecyclerGetChunk() call
will be free if it wasn't locked.
RecyclerGetChunk ()
void* RecyclerGetChunk (recycler_t *Recycler); |
The returned element isn't locked:
a second call to RecyclerGetChunk() without a call to RecyclerLockChunk()
will return the same element.
RecyclerLockChunk ()
void RecyclerLockChunk (const void *Data); |
Lock a recycler element to avoid it to be reused.
RecyclerReleaseChunk ()
void RecyclerReleaseChunk (const void *Data); |
Liberate an element from recycler for it to be reused.
RecyclerIsLocked ()
int RecyclerIsLocked (const void *data); |
RecyclerGetChunksMax()
#define RecyclerGetChunksMax(recycler) recycler->max |
RecyclerGetChunksCount()
#define RecyclerGetChunksCount(recycler) recycler->count |
RecyclerHasFreeChunks()
#define RecyclerHasFreeChunks(recycler) (Recycler->freelist != NULL) |