mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-31 18:55:49 +00:00
speed up loop
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12861 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
7cdc96e889
commit
3d73952cdb
@ -640,7 +640,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
|
|||||||
uint32_t gateway_loops = 0;
|
uint32_t gateway_loops = 0;
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
uint32_t qsize;
|
uint32_t qsize;
|
||||||
|
void *pop;
|
||||||
|
|
||||||
ireg_loops = IREG_SECONDS;
|
ireg_loops = IREG_SECONDS;
|
||||||
gateway_loops = GATEWAY_SECONDS;
|
gateway_loops = GATEWAY_SECONDS;
|
||||||
|
|
||||||
@ -652,7 +653,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
|
|||||||
|
|
||||||
while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) {
|
while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) {
|
||||||
if (qsize) {
|
if (qsize) {
|
||||||
void *pop;
|
|
||||||
switch_mutex_lock(profile->ireg_mutex);
|
switch_mutex_lock(profile->ireg_mutex);
|
||||||
while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
|
while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
|
||||||
sofia_glue_actually_execute_sql(profile, SWITCH_TRUE, (char *) pop, NULL);
|
sofia_glue_actually_execute_sql(profile, SWITCH_TRUE, (char *) pop, NULL);
|
||||||
@ -675,10 +675,17 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
|
|||||||
loops = 0;
|
loops = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_yield(10000);
|
switch_cond_next();
|
||||||
qsize = switch_queue_size(profile->sql_queue);
|
qsize = switch_queue_size(profile->sql_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_mutex_lock(profile->ireg_mutex);
|
||||||
|
while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
|
||||||
|
sofia_glue_actually_execute_sql(profile, SWITCH_TRUE, (char *) pop, NULL);
|
||||||
|
free(pop);
|
||||||
|
}
|
||||||
|
switch_mutex_unlock(profile->ireg_mutex);
|
||||||
|
|
||||||
sofia_clear_pflag_locked(profile, PFLAG_WORKER_RUNNING);
|
sofia_clear_pflag_locked(profile, PFLAG_WORKER_RUNNING);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user