Add page support to object pool
This commit is contained in:
@@ -5,18 +5,22 @@
|
||||
|
||||
typedef struct BzObjectPool BzObjectPool;
|
||||
|
||||
typedef void (*BzObjectPoolFunc)(void *object);
|
||||
|
||||
typedef struct BzObjectPoolDesc {
|
||||
size_t objectSize;
|
||||
size_t numObjects;
|
||||
size_t objectsPerPage;
|
||||
BzObjectPoolFunc constructor;
|
||||
BzObjectPoolFunc destructor;
|
||||
} BzObjectPoolDesc;
|
||||
|
||||
BzObjectPool *bzObjectPoolCreate(const BzObjectPoolDesc *desc);
|
||||
void bzObjectPoolDestroy(BzObjectPool *pool);
|
||||
|
||||
size_t bzObjectPoolCalcNumFree(BzObjectPool *pool);
|
||||
size_t bzObjectPoolGetNumFree(BzObjectPool *pool);
|
||||
void *bzObjectPool(BzObjectPool *pool);
|
||||
void *bzObjectPoolGetObject(BzObjectPool *pool, i32 idx);
|
||||
i32 bzObjectPoolGetIdx(BzObjectPool *pool, void *object);
|
||||
void *bzObjectPoolGetObject(BzObjectPool *pool, u32 idx);
|
||||
u32 bzObjectPoolGetIdx(BzObjectPool *pool, void *object);
|
||||
void bzObjectPoolRelease(BzObjectPool *pool, void *object);
|
||||
|
||||
#endif //BREEZE_OBJECT_POOL_H
|
||||
|
||||
Reference in New Issue
Block a user