git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3388 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-11-16 19:43:25 +00:00
parent ff4d2b3dcc
commit 89989bc34f
3 changed files with 15 additions and 5 deletions

View File

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

View File

@ -195,6 +195,7 @@ int main(int argc, char *argv[])
char pid_path[256] = ""; // full path to the pid file
const char *err = NULL; // error value for return from freeswitch initialization
int bg = 0; // TRUE if we are running in background mode
int vg = 0; // TRUE if we are running in vg mode
FILE *f; // file handle to the pid file
pid_t pid = 0; //
int x; //
@ -265,6 +266,10 @@ int main(int argc, char *argv[])
if (argv[x] && !strcmp(argv[x], "-nc")) {
bg++;
}
if (argv[x] && !strcmp(argv[x], "-vg")) {
vg++;
}
}
if (die) {
@ -302,5 +307,5 @@ int main(int argc, char *argv[])
switch_core_runtime_loop(bg);
return switch_core_destroy();
return switch_core_destroy(vg);
}

View File

@ -4070,7 +4070,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, uint32
return 0;
}
SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg)
{
switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) {
@ -4097,7 +4097,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
switch_core_db_close(runtime.db);
switch_core_db_close(runtime.event_db);
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_shutdown();
@ -4108,7 +4110,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
if (runtime.memory_pool) {
apr_pool_destroy(runtime.memory_pool);
apr_terminate();
if (!vg) {
apr_terminate();
}
}
#ifdef WIN32