From: Jeffrey Altman Date: Sat, 20 Mar 2004 18:42:16 +0000 (+0000) Subject: prevent-crash-at-shutdown-20040320 X-Git-Tag: openafs-devel-1_3_61~12 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=e3b52b0bc6089a100df804698c96081cd48e8229;p=packages%2Fo%2Fopenafs.git 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. --- diff --git a/src/WINNT/afsd/afsd_flushvol.c b/src/WINNT/afsd/afsd_flushvol.c index d0dce41bb..e2238d7c9 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); } }