[Freeswitch-trunk] [commit] r12705 - freeswitch/trunk/src

FreeSWITCH SVN anthm at freeswitch.org
Sat Mar 21 09:47:58 PDT 2009


Author: anthm
Date: Sat Mar 21 11:47:57 2009
New Revision: 12705

Log:
add mutex to global mem pool and tweak var code

Modified:
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_core_memory.c

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Sat Mar 21 11:47:57 2009
@@ -485,7 +485,7 @@
 
 SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname)
 {
-	const char *v = NULL;
+	const char *v = NULL, *r = NULL;
 	switch_assert(channel != NULL);
 
 	switch_mutex_lock(channel->profile_mutex);
@@ -507,17 +507,17 @@
 		}
 	}
 
-	if (v) v = switch_core_session_strdup(channel->session, v);
+	if (v) r = switch_core_session_strdup(channel->session, v);
 	
 	switch_mutex_unlock(channel->profile_mutex);
 
-	return v;
+	return r;
 }
 
 SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname)
 {
 	const char *uuid;
-	const char *val = NULL;
+	const char *val = NULL, *r = NULL;
 	switch_assert(channel != NULL);
 	
 	if (!switch_strlen_zero(varname)) {
@@ -531,9 +531,9 @@
 		}
 	}
 
-	if (val) val = switch_core_session_strdup(channel->session, val);
+	if (val) r = switch_core_session_strdup(channel->session, val);
 
-	return val;
+	return r;
 }
 
 

Modified: freeswitch/trunk/src/switch_core_memory.c
==============================================================================
--- freeswitch/trunk/src/switch_core_memory.c	(original)
+++ freeswitch/trunk/src/switch_core_memory.c	Sat Mar 21 11:47:57 2009
@@ -569,11 +569,12 @@
 		abort();
 	}
 
-	if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_DEFAULT, memory_manager.memory_pool)) != APR_SUCCESS) {
+	if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, memory_manager.memory_pool)) != APR_SUCCESS) {
 		abort();
 	}
 
 	apr_allocator_mutex_set(my_allocator, my_mutex);
+	apr_pool_mutex_set(memory_manager.memory_pool, my_mutex);
 	apr_allocator_owner_set(my_allocator, memory_manager.memory_pool);
 #else
 	apr_pool_create(&memory_manager.memory_pool, NULL);



More information about the Freeswitch-trunk mailing list