Ensure logging threads exit.
[nssm.git] / service.cpp
index 336cf27..937a2ec 100644 (file)
@@ -2060,6 +2060,9 @@ void CALLBACK end_service(void *arg, unsigned char why) {
   service->exit_count++;\r
   (void) nssm_hook(&hook_threads, service, NSSM_HOOK_EVENT_EXIT, NSSM_HOOK_ACTION_POST, NULL, NSSM_HOOK_DEADLINE, true);\r
 \r
+  /* Exit logging threads. */\r
+  cleanup_loggers(service);\r
+\r
   /*\r
     The why argument is true if our wait timed out or false otherwise.\r
     Our wait is infinite so why will never be true when called by the system.\r
@@ -2110,7 +2113,6 @@ void CALLBACK end_service(void *arg, unsigned char why) {
       log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_EXIT_UNCLEAN, service->name, code, exit_action_strings[action], 0);\r
       stop_service(service, exitcode, false, default_action);\r
       wait_for_hooks(service, false);\r
-      free_imports();\r
       nssm_exit(exitcode);\r
   }\r
 }\r