]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
LBAPR-4
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 29 Jun 2010 13:51:26 +0000 (08:51 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 29 Jun 2010 13:51:39 +0000 (08:51 -0500)
src/switch_apr.c
src/switch_core_memory.c

index d579999356374e98f72ba20d80fd900115415c77..ba44ad224ad299b72971ac6a7499d5d9724ad958 100644 (file)
@@ -89,11 +89,6 @@ SWITCH_DECLARE(int) switch_thread_equal(switch_thread_id_t tid1, switch_thread_i
 
 }
 
-SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p)
-{
-       apr_pool_clear(p);
-}
-
 SWITCH_DECLARE(unsigned int) switch_ci_hashfunc_default(const char *char_key, switch_ssize_t *klen)
 {
        unsigned int hash = 0;
index 42ef86a08f3fa06ecc0b7e7652c29473ab53182a..39d0403c4247bf14717d5450882c378d70207336 100644 (file)
@@ -318,6 +318,29 @@ SWITCH_DECLARE(void) switch_core_memory_pool_tag(switch_memory_pool_t *pool, con
        apr_pool_tag(pool, tag);
 }
 
+SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p)
+{
+#ifdef PER_POOL_LOCK
+       apr_thread_mutex_t *my_mutex;
+       apr_pool_mutex_set(p, NULL);
+#endif
+
+       apr_pool_clear(p);
+
+#ifdef PER_POOL_LOCK
+
+       if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, p)) != APR_SUCCESS) {
+               abort();
+       }
+
+       apr_pool_mutex_set(p, my_mutex);
+
+#endif
+
+}
+
+
+
 SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line)
 {
        char *tmp;
@@ -503,6 +526,7 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
                                switch_mutex_unlock(memory_manager.mem_lock);
 #endif
 #else
+                               apr_pool_mutex_set(pop, NULL);
                                apr_pool_clear(pop);
                                if (switch_queue_trypush(memory_manager.pool_recycle_queue, pop) != SWITCH_STATUS_SUCCESS) {
 #ifdef USE_MEM_LOCK