From: Iain Patterson Date: Thu, 31 Oct 2013 13:22:02 +0000 (+0000) Subject: Delay report that the service is running. X-Git-Tag: v2.17~7 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=c50225935f0143fbe5fb37d906aa7e6e68f81040;hp=23b8173ce06a843f18a9269fc6f7d4d0d224cd4c;p=nssm.git Delay report that the service is running. Wait until the application has been running for long enough to be exempt from restart throttling before reporting a status of SERVICE_RUNNING to the operating system. Thanks Tom Saul. --- diff --git a/service.cpp b/service.cpp index 873b8a8..1e78c3c 100644 --- a/service.cpp +++ b/service.cpp @@ -404,13 +404,13 @@ int start_service() { close_output_handles(&si); + /* Wait for a clean startup. */ + if (WaitForSingleObject(process_handle, throttle_delay) == WAIT_TIMEOUT) throttle = 0; + /* Signal successful start */ service_status.dwCurrentState = SERVICE_RUNNING; SetServiceStatus(service_handle, &service_status); - /* Wait for a clean startup. */ - if (WaitForSingleObject(process_handle, throttle_delay) == WAIT_TIMEOUT) throttle = 0; - return 0; }