runtime.console = stdout;
}
+ SSL_library_init();
switch_ssl_init_ssl_locks();
switch_curl_init();
switch_core_hash_insert(runtime.ptimes, "isac", &d_30);
switch_core_hash_insert(runtime.ptimes, "G723", &d_30);
- if (runtime.cpu_count == 1) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
- "Implicitly setting events-use-dispatch based on a single CPU\n");
- runtime.events_use_dispatch = 1;
- }
if ((xml = switch_xml_open_cfg(file, &cfg, NULL))) {
switch_xml_t settings, param;
} else if (!strcasecmp(var, "tipping-point") && !zstr(val)) {
runtime.tipping_point = atoi(val);
} else if (!strcasecmp(var, "events-use-dispatch") && !zstr(val)) {
- runtime.events_use_dispatch = 1;
+ runtime.events_use_dispatch = switch_true(val);
} else if (!strcasecmp(var, "initial-event-threads") && !zstr(val)) {
int tmp;
}
runtime.runlevel++;
+ runtime.events_use_dispatch = 1;
switch_core_set_signal_handlers();
switch_load_network_lists(SWITCH_FALSE);
return SWITCH_STATUS_SUCCESS;
}
+static void check_dispatch(void)
+{
+ if (!EVENT_DISPATCH_QUEUE) {
+ switch_mutex_lock(BLOCK);
+
+ if (!EVENT_DISPATCH_QUEUE) {
+ switch_queue_create(&EVENT_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, THRUNTIME_POOL);
+ switch_event_launch_dispatch_threads(1);
+
+ while (!THREAD_COUNT) {
+ switch_cond_next();
+ }
+ }
+ switch_mutex_unlock(BLOCK);
+ }
+}
+
+
+
SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max)
{
switch_threadattr_t *thd_attr;
switch_memory_pool_t *pool = RUNTIME_POOL;
+ check_dispatch();
+
if (max > MAX_DISPATCH) {
return;
}
switch_queue_create(&EVENT_HEADER_RECYCLE_QUEUE, 250000, THRUNTIME_POOL);
#endif
+ check_dispatch();
+
switch_mutex_lock(EVENT_QUEUE_MUTEX);
SYSTEM_RUNNING = 1;
switch_mutex_unlock(EVENT_QUEUE_MUTEX);
if (runtime.events_use_dispatch) {
- if (!EVENT_DISPATCH_QUEUE) {
- switch_mutex_lock(BLOCK);
-
- if (!EVENT_DISPATCH_QUEUE) {
- switch_queue_create(&EVENT_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, THRUNTIME_POOL);
- switch_event_launch_dispatch_threads(1);
-
- while (!THREAD_COUNT) {
- switch_cond_next();
- }
- }
- switch_mutex_unlock(BLOCK);
- }
+ check_dispatch();
if (switch_event_queue_dispatch_event(event) != SWITCH_STATUS_SUCCESS) {
switch_event_destroy(event);