Author: mturk Date: Tue Mar 26 12:05:46 2013 New Revision: 1461070 URL: http://svn.apache.org/r1461070 Log: DAEMON-288: Apply patch provided by Mike Miller
Modified: commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c Modified: commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt?rev=1461070&r1=1461069&r2=1461070&view=diff ============================================================================== --- commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt (original) +++ commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt Tue Mar 26 12:05:46 2013 @@ -84,7 +84,7 @@ NEW FEATURES: BUG FIXES: -1.0.15: +1.0.15: DAEMON-288 1.0.14: DAEMON-278, DAEMON-280, DAEMON-281, DAEMON-283, DAEMON-284, DAEMON-286, DAEMON-287 Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c?rev=1461070&r1=1461069&r2=1461070&view=diff ============================================================================== --- commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c (original) +++ commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c Tue Mar 26 12:05:46 2013 @@ -1076,7 +1076,6 @@ cleanup: CloseHandle(gSignalThread); gSignalEvent = NULL; } - SetEvent(gShutdownEvent); if (timeout > 0x7FFFFFFF) timeout = INFINITE; /* If the timeout was '-1' wait forewer */ if (wait_to_die && !timeout) @@ -1112,8 +1111,8 @@ cleanup: apxHandleSendMessage(gWorker, WM_CLOSE, 0, 0); } - apxLogWrite(APXLOG_MARK_INFO "Service stopped."); - reportServiceStatusStopped(0); + apxLogWrite(APXLOG_MARK_INFO "Service stop thread completed."); + SetEvent(gShutdownEvent); return rv; } @@ -1538,15 +1537,18 @@ void WINAPI serviceMain(DWORD argc, LPTS goto cleanup; } if (gShutdownEvent) { - reportServiceStatus(SERVICE_STOP_PENDING, NO_ERROR, 0); + /* Ensure that shutdown thread exits before us */ apxLogWrite(APXLOG_MARK_DEBUG "Waiting for ShutdownEvent"); + reportServiceStatus(SERVICE_STOP_PENDING, NO_ERROR, ONE_MINUTE); WaitForSingleObject(gShutdownEvent, ONE_MINUTE); apxLogWrite(APXLOG_MARK_DEBUG "ShutdownEvent signaled"); CloseHandle(gShutdownEvent); + /* This will cause to wait for all threads to exit */ apxLogWrite(APXLOG_MARK_DEBUG "Waiting 1 minute for all threads to exit"); + reportServiceStatus(SERVICE_STOP_PENDING, NO_ERROR, ONE_MINUTE); apxDestroyJvm(ONE_MINUTE); } else {