The thread triggering finalizer shutdown events should be in an alertable state....
authorAaron Robinson <arobins@microsoft.com>
Sat, 20 Apr 2019 05:11:39 +0000 (22:11 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 20 Apr 2019 05:11:39 +0000 (22:11 -0700)
src/vm/finalizerthread.h

index d5063b2..3a62814 100644 (file)
@@ -68,7 +68,11 @@ public:
 
         // Do not wait for FinalizerThread if the current one is FinalizerThread.
         if (GetThread() != GetFinalizerThread())
-            hEventFinalizerToShutDown->Wait(INFINITE,FALSE);
+        {
+            // This wait must be alertable to handle cases where the current
+            // thread's context is needed (i.e. RCW cleanup)
+            hEventFinalizerToShutDown->Wait(INFINITE, /*alertable*/ TRUE);
+        }
     }
 
     static void FinalizerThreadWait(DWORD timeout = INFINITE);