From e3b52b0bc6089a100df804698c96081cd48e8229 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 20 Mar 2004 18:42:16 +0000 Subject: [PATCH] prevent-crash-at-shutdown-20040320 The Power Management Exit routine was instructing the thread to terminate but was not waiting for the conclusion of the operation before returning control to the caller. This allows the service to pass control to the Service Manager before cleanup was properly completed. --- src/WINNT/afsd/afsd_flushvol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WINNT/afsd/afsd_flushvol.c b/src/WINNT/afsd/afsd_flushvol.c index d0dce41bba..e2238d7c92 100644 --- a/src/WINNT/afsd/afsd_flushvol.c +++ b/src/WINNT/afsd/afsd_flushvol.c @@ -341,7 +341,6 @@ afsd_ServiceFlushVolumesThreadProc(LPVOID lpParam) case WAIT_OBJECT_0: // termination signaled RevertToSelf(); - Sleep(500); ExitThread(0); break; @@ -488,6 +487,7 @@ PowerNotificationThreadExit() if (gThreadHandle) { SetEvent(gThreadInfo.hEventTerminate); + WaitForSingleObject(gThreadHandle, INFINITE); CloseHandle(gThreadHandle); } }