switch_set_flag_locked(conference, CFLAG_RUNNING);
switch_threadattr_create(&thd_attr, conference->pool);
switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_priority_increase(thd_attr);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_mutex_lock(globals.hash_mutex);
switch_mutex_unlock(globals.hash_mutex);
msg_queue_threads++;
switch_mutex_unlock(mod_sofia_globals.mutex);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MSG Thread %d Started\n", my_id);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "MSG Thread %d Started\n", my_id);
for(;;) {
if (pop) {
sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) pop;
sofia_process_dispatch_event(&de);
+ switch_os_yield();
} else {
break;
}
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MSG Thread Ended\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "MSG Thread Ended\n");
switch_mutex_lock(mod_sofia_globals.mutex);
msg_queue_threads--;
if (profile->pres_type) {
switch_cond_next();
+ } else {
+ switch_os_yield();
}
char data[] = "-1\n";
struct sched_param sched = { 0 };
sched.sched_priority = 1;
- if (sched_setscheduler(0, SCHED_FIFO, &sched)) {
+ if (sched_setscheduler(0, SCHED_RR, &sched)) {
sched.sched_priority = 0;
if (sched_setscheduler(0, SCHED_OTHER, &sched)) {
return -1;
switch_assert(session != NULL);
+ switch_os_yield();
+
if (switch_mutex_trylock(session->codec_read_mutex) == SWITCH_STATUS_SUCCESS) {
switch_mutex_unlock(session->codec_read_mutex);
} else {
switch_threadattr_create(&thd_attr, sql_manager.memory_pool);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-
+ switch_threadattr_priority_increase(thd_attr);
switch_core_sqldb_start_thread();
switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Starting SQL thread.\n");
switch_threadattr_create(&thd_attr, sql_manager.memory_pool);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_threadattr_priority_increase(thd_attr);
switch_thread_create(&sql_manager.thread, thd_attr, switch_core_sql_thread, NULL, sql_manager.memory_pool);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL thread is already running\n");
event = (switch_event_t *) pop;
switch_event_deliver(&event);
+ switch_os_yield();
}
#if defined(WIN32)
SwitchToThread();
#else
+ usleep(1);
sched_yield();
#endif
}
while (globals.RUNNING == 1 && private_info->ready && TIMER_MATRIX[timer->interval].tick < private_info->reference) {
check_roll();
+ switch_os_yield();
+
+
if (runtime.tipping_point && globals.timer_count >= runtime.tipping_point) {
- switch_os_yield();
globals.use_cond_yield = 0;
} else {
if (globals.use_cond_yield == 1) {