+ /*\r
+ We MUST acknowledge the stop request promptly but we're committed to\r
+ waiting for the application to exit. Spawn a new thread to wait\r
+ while we acknowledge the request.\r
+ */\r
+ if (! CreateThread(NULL, 0, shutdown_service, (void *) service_name, 0, NULL)) {\r
+ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATETHREAD_FAILED, error_string(GetLastError()), 0);\r
+\r
+ /*\r
+ We couldn't create a thread to tidy up so we'll have to force the tidyup\r
+ to complete in time in this thread.\r
+ */\r
+ kill_console_delay = NSSM_KILL_CONSOLE_GRACE_PERIOD;\r
+ kill_window_delay = NSSM_KILL_WINDOW_GRACE_PERIOD;\r
+ kill_threads_delay = NSSM_KILL_THREADS_GRACE_PERIOD;\r
+\r
+ stop_service(0, true, true);\r
+ }\r