void terminate_console(int /*sig*/) { // WSA_Cleanup(); /* TODO: check when we have to call it */ my_config->free_all_resources(); free(my_config); my_config = NULL; term_msg(); exit(0); }
/* Cleanup and then exit */ void terminate_dird(int sig) { static bool already_here = false; if (already_here) { /* avoid recursive temination problems */ bmicrosleep(2, 0); /* yield */ exit(1); } already_here = true; debug_level = 0; /* turn off debug */ stop_watchdog(); db_sql_pool_destroy(); db_flush_backends(); unload_dir_plugins(); write_state_file(me->working_directory, "bareos-dir", get_first_port_host_order(me->DIRaddrs)); delete_pid_file(me->pid_directory, "bareos-dir", get_first_port_host_order(me->DIRaddrs)); term_scheduler(); term_job_server(); if (runjob) { free(runjob); } if (configfile != NULL) { free(configfile); } if (debug_level > 5) { print_memory_pool_stats(); } if (my_config) { my_config->free_resources(); free(my_config); my_config = NULL; } stop_UA_server(); term_msg(); /* terminate message handler */ cleanup_crypto(); close_memory_pool(); /* release free memory in pool */ lmgr_cleanup_main(); sm_dump(false); exit(sig); }
void MonitorItemThread::run() { /* all this must be run in the same * context of the MonitorItemThread */ lmgr_init_thread(); if (monitor) { refreshTimer->start(monitor->RefreshInterval * 1000); } exec(); while (items.count()) { MonitorItem* item = items.first(); item->disconnect(); delete item; items.removeFirst(); } term_msg(); // this cannot be called twice, however }