[threads] Make OSEvent alertable to fix bug #51653 (#4347)
[mono.git] / mono / metadata / gc.c
index 9060cf400e012cdd756af2fa2de2b9ada65f71b3..7594090b1d48da5766a663f2af739e796259fec5 100644 (file)
@@ -28,7 +28,6 @@
 #include <mono/sgen/sgen-conf.h>
 #include <mono/sgen/sgen-gc.h>
 #include <mono/utils/mono-logger-internals.h>
-#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/marshal.h> /* for mono_delegate_free_ftnptr () */
 #include <mono/metadata/attach.h>
 #include <mono/metadata/console-io.h>
@@ -889,7 +888,7 @@ finalizer_thread (gpointer unused)
        MonoError error;
        gboolean wait = TRUE;
 
-       mono_thread_set_name_internal (mono_thread_internal_current (), mono_string_new (mono_get_root_domain (), "Finalizer"), FALSE, &error);
+       mono_thread_set_name_internal (mono_thread_internal_current (), mono_string_new (mono_get_root_domain (), "Finalizer"), FALSE, FALSE, &error);
        mono_error_assert_ok (&error);
 
        /* Register a hazard free queue pump callback */
@@ -1063,8 +1062,9 @@ mono_gc_cleanup (void)
                        }
 
 
-                       /* Wait for the thread to actually exit */
-                       ret = guarded_wait (gc_thread->handle, MONO_INFINITE_WAIT, TRUE);
+                       /* Wait for the thread to actually exit. We don't want the wait
+                        * to be alertable, because we assert on the result to be SUCCESS_0 */
+                       ret = guarded_wait (gc_thread->handle, MONO_INFINITE_WAIT, FALSE);
                        g_assert (ret == MONO_THREAD_INFO_WAIT_RET_SUCCESS_0);
 
                        mono_thread_join (GUINT_TO_POINTER (gc_thread->tid));