Remove invalid asserts in threads.cpp, DoAppropriateWaitWorker(int, ...)
authorKoundinya Veluri <kouvel@microsoft.com>
Sat, 14 Jan 2017 05:18:34 +0000 (21:18 -0800)
committerKoundinya Veluri <kouvel@microsoft.com>
Sat, 14 Jan 2017 05:21:25 +0000 (21:21 -0800)
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

index 732cb2d..5a2816b 100644 (file)
@@ -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);
         }
     }