file
object_pool.hThread-safe object pool implementation.
Typedefs
- using ObjectCreatorFunc = void*(*)(void)
- Function to call to create the objects in the pool.
- using ObjectFreeFunc = void(*)(void*)
- Function to call to free the objects in the pool.
Functions
- auto object_pool_new(ObjectCreatorFunc create_func, ObjectFreeFunc free_func, int max_objects) -> ObjectPool*
- Creates a new object pool.
- auto object_pool_get(ObjectPool* self) -> void*
- Returns an available object.
- auto object_pool_get_num_available(ObjectPool* self) -> int
- Returns the number of available objects.
- void object_pool_return(ObjectPool* self, void* object)
- Puts an object back in the pool.
- void object_pool_free(ObjectPool* self)
- Frees the pool and all its objects.
Function documentation
int object_pool_get_num_available(ObjectPool* self)
Returns the number of available objects.