10#ifndef __UTILS_OBJECT_POOL_H__
11#define __UTILS_OBJECT_POOL_H__
21typedef void * (*ObjectCreatorFunc) (void);
29 int num_obj_available;
void(* ObjectFreeFunc)(void *)
Function to call to free objects.
void * object_pool_get(ObjectPool *self)
Returns an available object.
void object_pool_free(ObjectPool *self)
Frees the pool and all its objects.
int object_pool_get_num_available(ObjectPool *self)
Returns the number of available objects.
ObjectPool * object_pool_new(ObjectCreatorFunc create_func, ObjectFreeFunc free_func, int max_objects)
Creates a new object pool.
void *(* ObjectCreatorFunc)(void)
Function to call to create the objects in the pool.
void object_pool_return(ObjectPool *self, void *object)
Puts an object back in the pool.
void ** obj_available
Available objects.
ZixSem access_sem
Semaphore for atomic operations.
ObjectFreeFunc free_func
Object free func.