From: Anthony Minessale Date: Wed, 22 Sep 2010 23:14:24 +0000 (-0500) Subject: MODAPP-459 X-Git-Tag: v1.2-rc1~291^2~40^2~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b02c69bba9f46cad37225a0986cae068f24dcd81;p=thirdparty%2Ffreeswitch.git MODAPP-459 --- diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 9b8b051f50..ec9c2ed352 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -203,9 +203,9 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * goto end; } - while(t38_state_list.thread_running) { + switch_mutex_lock(globals.cond_mutex); - switch_mutex_lock(globals.cond_mutex); + while(t38_state_list.thread_running) { switch_mutex_lock(t38_state_list.mutex); @@ -226,6 +226,8 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * switch_core_timer_next(&timer); } + + switch_mutex_unlock(globals.cond_mutex); end: diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 6bde9e53af..0cc4da3f13 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -911,10 +911,9 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, sql_manager.thread_running = 1; - while (sql_manager.thread_running == 1) { - - switch_mutex_lock(sql_manager.cond_mutex); + switch_mutex_lock(sql_manager.cond_mutex); + while (sql_manager.thread_running == 1) { if (sql || switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || switch_queue_trypop(sql_manager.sql_queue[1], &pop) == SWITCH_STATUS_SUCCESS) { @@ -993,6 +992,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, } } + switch_mutex_unlock(sql_manager.cond_mutex); + while (switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS) { free(pop); }