开始设计
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#ifndef INCLUDED_C_POOL_H
|
||||
#define INCLUDED_C_POOL_H
|
||||
|
||||
#ifndef INCLUDED_C_BASE_H
|
||||
#include <c_Base.h>
|
||||
#endif /*INCLUDED_C_BASE_H*/
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
typedef struct c_PoolBlockList_t c_PoolBlockList_t;
|
||||
|
||||
typedef struct {
|
||||
c_PoolBlockList_t* blockAllocator;
|
||||
int objSize;
|
||||
int chunkSize;
|
||||
c_size_t instanceCount;
|
||||
struct c_PoolLink_t{ struct c_PoolLink_t* next;} * freelist;
|
||||
}c_Pool_t;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
c_err_t c_Pool_Init(c_Pool_t* self, int objSize, int chunkSize);
|
||||
|
||||
void c_Pool_Destroy(c_Pool_t* self);
|
||||
|
||||
void* c_Pool_Alloc(c_Pool_t* self);
|
||||
|
||||
void c_Pool_Free(c_Pool_t* self, void* ptr);
|
||||
|
||||
void c_Pool_DryUp(c_Pool_t* self);
|
||||
|
||||
|
||||
|
||||
#endif /*INCLUDED_C_POOL_H*/
|
||||
Reference in New Issue
Block a user