From 09a82c2ece4caadad0baa0d1f3b84f1506363fdd Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期五, 22 一月 2021 11:58:33 +0800
Subject: [PATCH] update

---
 src/shm/mem_pool.h |   23 +++--------------------
 1 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/src/shm/mem_pool.h b/src/shm/mem_pool.h
index 2ea1f6b..5a698ec 100644
--- a/src/shm/mem_pool.h
+++ b/src/shm/mem_pool.h
@@ -4,42 +4,25 @@
 #include "sem_util.h"
 #define MEM_POOL_COND_KEY 0x8801
 
-static int mem_pool_cond  = SemUtil::get(MEM_POOL_COND_KEY, 0);
 
 // static int mem_pool_mutex  = SemUtil::get(MEM_POOL_COND_KEY, 1);
 
 static inline void mem_pool_init(size_t heap_size) {
-	if(mm_init(heap_size)) {
-		 
-	}
+	mm_init(heap_size);
 }
 
 static inline void mem_pool_destroy(void) {
-	if(mm_destroy()) {
-		SemUtil::remove(mem_pool_cond);
-	}
+	mm_destroy();
 	
 }
 
 static inline void *mem_pool_malloc (size_t size) {
-	void *ptr;
-	while( (ptr = mm_malloc(size)) == NULL ) {
-		err_msg(0, "There is not enough memery to allocate, waiting someone else to free.");
-		SemUtil::set(mem_pool_cond, 0);
-		// wait for someone else to free space
-		SemUtil::dec(mem_pool_cond);
-
-	}
-	
-	return ptr;
+	return  mm_malloc(size);
 }
 
 
 static inline void mem_pool_free (void *ptr) {
 	mm_free(ptr);
-	// notify malloc
-	SemUtil::set(mem_pool_cond, 1);
-
 }
 
 

--
Gitblit v1.8.0