From 5a96512345a7024cb676528f52233cff630fff95 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 Mar 2015 16:44:53 -0600 Subject: [PATCH] FS-7305 #resolve --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 8 ++++++++ src/switch_event.c | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index c2fc659187..3380c43b72 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1641,6 +1641,10 @@ void mod_spandsp_fax_load(switch_memory_pool_t *pool) switch_mutex_init(&spandsp_globals.cond_mutex, SWITCH_MUTEX_NESTED, spandsp_globals.pool); switch_thread_cond_create(&spandsp_globals.cond, spandsp_globals.pool); + if (switch_core_test_flag(SCF_MINIMAL)) { + return; + } + launch_timer_thread(); while(--sanity && !t38_state_list.thread_running) { @@ -1652,6 +1656,10 @@ void mod_spandsp_fax_shutdown(void) { switch_status_t tstatus = SWITCH_STATUS_SUCCESS; + if (switch_core_test_flag(SCF_MINIMAL)) { + return; + } + t38_state_list.thread_running = 0; wake_thread(1); switch_thread_join(&tstatus, t38_state_list.thread); diff --git a/src/switch_event.c b/src/switch_event.c index 9491a9f383..13ce7b1f8d 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -529,6 +529,10 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) const void *var; void *val; + if (switch_core_test_flag(SCF_MINIMAL)) { + return SWITCH_STATUS_SUCCESS; + } + switch_mutex_lock(EVENT_QUEUE_MUTEX); SYSTEM_RUNNING = 0; switch_mutex_unlock(EVENT_QUEUE_MUTEX); @@ -659,6 +663,7 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max) SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) { + /* don't need any more dispatch threads than we have CPU's*/ MAX_DISPATCH = (switch_core_cpu_count() / 2) + 1; if (MAX_DISPATCH < 2) { @@ -667,13 +672,18 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) switch_assert(pool != NULL); THRUNTIME_POOL = RUNTIME_POOL = pool; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Eventing Engine.\n"); switch_thread_rwlock_create(&RWLOCK, RUNTIME_POOL); switch_mutex_init(&BLOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL); switch_mutex_init(&POOL_LOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL); switch_mutex_init(&EVENT_QUEUE_MUTEX, SWITCH_MUTEX_NESTED, RUNTIME_POOL); switch_core_hash_init(&CUSTOM_HASH); + if (switch_core_test_flag(SCF_MINIMAL)) { + return SWITCH_STATUS_SUCCESS; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Eventing Engine.\n"); + switch_core_hash_init(&event_channel_manager.lahash); switch_mutex_init(&event_channel_manager.lamutex, SWITCH_MUTEX_NESTED, RUNTIME_POOL);