add mutex to global mem pool and tweak var code
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12705 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b7db753142
commit
14415b29f1
|
@ -485,7 +485,7 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch
|
|||
|
||||
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 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *chann
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_
|
|||
}
|
||||
}
|
||||
|
||||
if (val) val = switch_core_session_strdup(channel->session, val);
|
||||
if (val) r = switch_core_session_strdup(channel->session, val);
|
||||
|
||||
return val;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -569,11 +569,12 @@ switch_memory_pool_t *switch_core_memory_init(void)
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue