void * signal_task_shutdown_thread(void* ignored) { if(!dnscore_shuttingdown()) { log_debug("signal_task_shutdown_thread: begin"); program_mode = SA_SHUTDOWN; dnscore_shutdown(); log_debug("signal_task_shutdown_thread: end"); } pthread_exit(NULL); return NULL; }
void dnscore_finalize() { /* * No need to "finalize" format, dnsformat and rfc */ if(dnscore_finalizing) { /* OOPS : ALREADY BUSY SHUTTING DOWN */ /* DO NOT USE LOGGER HERE ! */ return; } dnscore_finalizing = TRUE; dnscore_shutdown(); #ifndef NDEBUG log_debug("exit: destroying the thread pool"); #endif logger_flush(); thread_pool_destroy(); #ifdef DEBUG log_debug("exit: bye (pid=%hd)", getpid()); logger_flush(); #endif scheduler_finalize(); logger_flush(); logger_finalize(); /** @note does a logger_stop */ logger_handle_finalize(); #ifndef NDEBUG /* * It may not be required right now, but in case the stdstream are filtered/buffered * this will flush them. */ #if HAS_TSIG_SUPPORT tsig_finalize(); #endif stdstream_flush_both_terms(); error_unregister_all(); rfc_finalize(); format_class_finalize(); #endif #ifndef NDEBUG #if ZDB_DEBUG_MALLOC != 0 debug_stat(TRUE); #endif #endif stdstream_flush_both_terms(); output_stream_close(&__termerr__); output_stream_close(&__termout__); }