git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4419 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-03-01 17:23:02 +00:00
parent c612d4226b
commit ed76b25241
5 changed files with 17 additions and 25 deletions

View File

@ -233,10 +233,9 @@ SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit);
/*! /*!
\brief Destroy the core \brief Destroy the core
\param vg nonzero to skip core uninitilize for memory debugging
\note to be called at application shutdown \note to be called at application shutdown
*/ */
SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg); SWITCH_DECLARE(switch_status_t) switch_core_destroy(void);
///\} ///\}

View File

@ -1045,9 +1045,14 @@ static switch_status_t load_config(void)
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void) SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
{ {
switch_core_codec_destroy(&globals.read_codec); if (globals.read_codec.implementation) {
switch_core_codec_destroy(&globals.write_codec); switch_core_codec_destroy(&globals.read_codec);
}
if (globals.write_codec.implementation) {
switch_core_codec_destroy(&globals.write_codec);
}
Pa_Terminate(); Pa_Terminate();
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;

View File

@ -198,9 +198,6 @@ int main(int argc, char *argv[])
const char *err = NULL; // error value for return from freeswitch initialization const char *err = NULL; // error value for return from freeswitch initialization
#ifndef WIN32 #ifndef WIN32
int nf = 0; // TRUE if we are running in nofork mode int nf = 0; // TRUE if we are running in nofork mode
int vg = 0; // Allways TRUE on windows to not do apr_terminate
#else
int vg = 1; // TRUE if we are running in vg mode
#endif #endif
int nc = 0; // TRUE if we are running in noconsole mode int nc = 0; // TRUE if we are running in noconsole mode
FILE *f; // file handle to the pid file FILE *f; // file handle to the pid file
@ -233,7 +230,6 @@ int main(int argc, char *argv[])
"\t-hp -- enable high priority settings\n" "\t-hp -- enable high priority settings\n"
"\t-stop -- stop freeswitch\n" "\t-stop -- stop freeswitch\n"
"\t-nc -- do not output to a console and background\n" "\t-nc -- do not output to a console and background\n"
"\t-vg -- enable valgrind mode\n"
"\t-conf [confdir] -- specify an alternate config dir\n" "\t-conf [confdir] -- specify an alternate config dir\n"
"\t-log [logdir] -- specify an alternate log dir\n" "\t-log [logdir] -- specify an alternate log dir\n"
"\t-db [dbdir] -- specify an alternate db dir\n"; "\t-db [dbdir] -- specify an alternate db dir\n";
@ -307,9 +303,6 @@ int main(int argc, char *argv[])
nc++; nc++;
} }
if (argv[x] && !strcmp(argv[x], "-vg")) {
vg++;
}
if (argv[x] && !strcmp(argv[x], "-conf")) { if (argv[x] && !strcmp(argv[x], "-conf")) {
x++; x++;
@ -389,7 +382,7 @@ int main(int argc, char *argv[])
switch_core_runtime_loop(nc); switch_core_runtime_loop(nc);
return switch_core_destroy(vg); return switch_core_destroy();
} }
/* For Emacs: /* For Emacs:

View File

@ -590,13 +590,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio
if (switch_test_flag(session, SSF_DESTROYED)) { if (switch_test_flag(session, SSF_DESTROYED)) {
status = SWITCH_STATUS_FALSE; status = SWITCH_STATUS_FALSE;
#ifdef SWITCH_DEBUG_RWLOCKS #ifdef SWITCH_DEBUG_RWLOCKS
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Read lock FAIL\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock FAIL\n",
switch_channel_get_name(session->channel)); switch_channel_get_name(session->channel));
#endif #endif
} else { } else {
status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock); status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock);
#ifdef SWITCH_DEBUG_RWLOCKS #ifdef SWITCH_DEBUG_RWLOCKS
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Read lock AQUIRED\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock AQUIRED\n",
switch_channel_get_name(session->channel)); switch_channel_get_name(session->channel));
#endif #endif
} }
@ -612,7 +612,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_
int line) int line)
{ {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Write lock AQUIRED\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n",
switch_channel_get_name(session->channel)); switch_channel_get_name(session->channel));
#else #else
SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session) SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session)
@ -627,7 +627,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_rwunlock(switch_core_session_t
const char *func, const char *func,
int line) int line)
{ {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Read/Write lock CLEARED\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read/Write lock CLEARED\n",
switch_channel_get_name(session->channel)); switch_channel_get_name(session->channel));
#else #else
SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session_t *session) SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session_t *session)
@ -4563,7 +4563,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, uint32
return 0; return 0;
} }
SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg) SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
{ {
switch_event_t *event; switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) { if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) {
@ -4590,9 +4590,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg)
switch_core_db_close(runtime.db); switch_core_db_close(runtime.db);
switch_core_db_close(runtime.event_db); switch_core_db_close(runtime.event_db);
switch_xml_destroy(); switch_xml_destroy();
if (vg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Full destruction of the core disabled for memory debugging purposes.\n");
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n");
switch_log_shutdown(); switch_log_shutdown();
@ -4617,9 +4614,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg)
if (runtime.memory_pool) { if (runtime.memory_pool) {
apr_pool_destroy(runtime.memory_pool); apr_pool_destroy(runtime.memory_pool);
if (!vg) { //apr_terminate();
apr_terminate();
}
} }
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;

View File

@ -75,7 +75,7 @@ static void *switch_loadable_module_exec(switch_thread_t *thread, void *obj)
for (restarts = 0; status != SWITCH_STATUS_TERM; restarts++) { for (restarts = 0; status != SWITCH_STATUS_TERM; restarts++) {
status = module->switch_module_runtime(); status = module->switch_module_runtime();
} }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread ended for %s\n", module->module_interface->module_name); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Thread ended for %s\n", module->module_interface->module_name);
if (ts->pool) { if (ts->pool) {
switch_memory_pool_t *pool = ts->pool; switch_memory_pool_t *pool = ts->pool;