working on task mem pool, there is a crash bug, use -ooodebug-disable-task-mem-pool...
[IRC.git] / Robust / src / Runtime / memPool.h
index 14c0fac17dc256e1a1abe2835db4de3b5ec10255..0bd4bad18c13f580689d53e834fcc3f1b327ac3b 100644 (file)
@@ -66,7 +66,7 @@ static MemPool* poolcreate( int itemSize ) {
 // otherwise someone did CAS before you, so try again (the return
 // value is the old value you will pass next time.)
 
-static inline void poolfree( MemPool* p, void* ptr ) {
+static inline void poolfreeinto( MemPool* p, void* ptr ) {
 
   MemPoolItem* tailCurrent;
   MemPoolItem* tailActual;
@@ -117,6 +117,20 @@ static inline void* poolalloc( MemPool* p ) {
 }
 
 
+static void pooldestroy( MemPool* p ) {
+  MemPoolItem* i = p->head;
+  MemPoolItem* n;
+
+  while( i != NULL ) {
+    n = i->next;
+    free( i );
+    i = n;
+  }
+
+  free( p );
+}
+
+
 #endif // ___MEMPOOL_H__