From 6901e5d2dadac88b49cbf5bc219f46f341db16d2 Mon Sep 17 00:00:00 2001 From: Koundinya Veluri Date: Fri, 13 Jan 2017 21:18:34 -0800 Subject: [PATCH] Remove invalid asserts in threads.cpp, DoAppropriateWaitWorker(int, ...) These cases are actually possible because Windows APIs are inconsistent in their behavior when invalid handles are concerned. Depending on the invalid handle's value, a multi-wait can error with ERROR_INVALID_HANDLE, and a single-wait on an invalid handle could return WAIT_TIMEOUT. Commit migrated from https://github.com/dotnet/coreclr/commit/4367c8d5205f233ddf9db2c0d23a330d4b72d05c --- src/coreclr/src/vm/threads.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/coreclr/src/vm/threads.cpp b/src/coreclr/src/vm/threads.cpp index 732cb2d..5a2816b 100644 --- a/src/coreclr/src/vm/threads.cpp +++ b/src/coreclr/src/vm/threads.cpp @@ -4533,9 +4533,6 @@ retry: { // Probe all handles with a timeout of zero. When we find one that's // invalid, move it out of the list and retry the wait. -#ifdef _DEBUG - BOOL fFoundInvalid = FALSE; -#endif for (int i = 0; i < countHandles; i++) { // WaitForSingleObject won't pump memssage; we already probe enough space @@ -4548,12 +4545,8 @@ retry: if ((countHandles - i - 1) > 0) memmove(&handles[i], &handles[i+1], (countHandles - i - 1) * sizeof(HANDLE)); countHandles--; -#ifdef _DEBUG - fFoundInvalid = TRUE; -#endif break; } - _ASSERTE(fFoundInvalid); // Compute the new timeout value by assume that the timeout // is not large enough for more than one wrap @@ -4599,7 +4592,6 @@ retry: _ASSERTE(subRet == WAIT_TIMEOUT); ret++; } - _ASSERTE(i != countHandles); } } -- 2.7.4