(svn r4471) - Pools: Add a facility for calling a custom function during pool block clean up.

This commit is contained in:
2006-04-18 18:48:50 +00:00
parent 24ef4ce560
commit ae7ec5cd0d
12 changed files with 20 additions and 12 deletions

4
pool.h
View File

@@ -8,6 +8,8 @@ typedef struct MemoryPool MemoryPool;
/* The function that is called after a new block is added
start_item is the first item of the new made block */
typedef void MemoryPoolNewBlock(uint start_item);
/* The function that is called before a block is cleaned up */
typedef void MemoryPoolCleanBlock(uint start_item, uint end_item);
/**
* Stuff for dynamic vehicles. Use the wrappers to access the MemoryPool
@@ -22,6 +24,8 @@ struct MemoryPool {
/// Pointer to a function that is called after a new block is added
MemoryPoolNewBlock *new_block_proc;
/// Pointer to a function that is called to clean a block
MemoryPoolCleanBlock *clean_block_proc;
uint current_blocks; ///< How many blocks we have in our pool
uint total_items; ///< How many items we now have in this pool