mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
optimize sofia sql by using new core transaction processor we will no longer support databases that do not support transactions
This commit is contained in:
+32
-13
@@ -1530,25 +1530,25 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_worker(switch_th
|
||||
}
|
||||
|
||||
if (check_status == SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_session_t *session = (switch_core_session_t *) pop;
|
||||
switch_size_t id;
|
||||
switch_thread_data_t *td = (switch_thread_data_t *) pop;
|
||||
|
||||
if (!session) break;
|
||||
if (!td) break;
|
||||
|
||||
id = session->id;
|
||||
|
||||
switch_mutex_lock(session_manager.mutex);
|
||||
session_manager.busy++;
|
||||
switch_mutex_unlock(session_manager.mutex);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Processing session %"SWITCH_SIZE_T_FMT" %s\n",
|
||||
(long) thread, id, switch_core_session_get_name(session));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Processing\n", (long) thread);
|
||||
|
||||
switch_core_session_thread(thread, (void *) session);
|
||||
|
||||
td->func(thread, td->obj);
|
||||
|
||||
if (td->alloc) {
|
||||
free(td);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Done Processing\n", (long) thread);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Done Processing session %"SWITCH_SIZE_T_FMT"\n",
|
||||
(long) thread, id);
|
||||
|
||||
switch_mutex_lock(session_manager.mutex);
|
||||
session_manager.busy--;
|
||||
switch_mutex_unlock(session_manager.mutex);
|
||||
@@ -1656,11 +1656,27 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_manager(switch_t
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_pool_launch_thread(switch_thread_data_t **tdp)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_thread_data_t *td;
|
||||
|
||||
switch_assert(tdp);
|
||||
|
||||
td = *tdp;
|
||||
*tdp = NULL;
|
||||
|
||||
switch_queue_push(session_manager.thread_queue, td);
|
||||
check_queue();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_core_session_t *session)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_INUSE;
|
||||
|
||||
switch_thread_data_t *td;
|
||||
|
||||
switch_mutex_lock(session->mutex);
|
||||
if (switch_test_flag(session, SSF_THREAD_RUNNING)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Cannot double-launch thread!\n");
|
||||
@@ -1670,7 +1686,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_co
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
switch_set_flag(session, SSF_THREAD_RUNNING);
|
||||
switch_set_flag(session, SSF_THREAD_STARTED);
|
||||
switch_queue_push(session_manager.thread_queue, session);
|
||||
td = switch_core_session_alloc(session, sizeof(*td));
|
||||
td->obj = session;
|
||||
td->func = switch_core_session_thread;
|
||||
switch_queue_push(session_manager.thread_queue, td);
|
||||
check_queue();
|
||||
}
|
||||
switch_mutex_unlock(session->mutex);
|
||||
|
||||
Reference in New Issue
Block a user