From dbc63ae672bcd65d87dbf4b1960904102cdcde97 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Thu, 17 Nov 2016 09:49:21 -0500 Subject: [PATCH] [runtime] Fix the waiting for background threads which got broken by 4a1161e2d691672e8544ce5a3e20e5c08daa4f45. (#3983) --- mono/metadata/threads.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index 34bdb07b755..51d7ccac064 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -3109,15 +3109,15 @@ build_wait_tids (gpointer key, gpointer value, gpointer user) } } -static gboolean -remove_and_abort_threads (gpointer key, gpointer value, gpointer user) +static void +collect_and_abort_threads (gpointer key, gpointer value, gpointer user) { WaitData *wait = (WaitData *)user; MonoNativeThreadId self = mono_native_thread_id_get (); MonoInternalThread *thread = (MonoInternalThread *)value; if (wait->num >= MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS) - return FALSE; + return; /* The finalizer thread is not a background thread */ if (!mono_native_thread_id_equals (thread_get_tid (thread), self) @@ -3127,11 +3127,8 @@ remove_and_abort_threads (gpointer key, gpointer value, gpointer user) THREAD_DEBUG (g_print ("%s: Aborting id: %"G_GSIZE_FORMAT"\n", __func__, (gsize)thread->tid)); mono_thread_internal_abort (thread); - return TRUE; + return; } - - return !mono_native_thread_id_equals (thread_get_tid (thread), self) - && !mono_gc_is_finalizer_internal_thread (thread); } /** @@ -3239,7 +3236,7 @@ mono_thread_manage (void) mono_threads_lock (); init_wait_data (wait); - mono_g_hash_table_foreach_remove (threads, remove_and_abort_threads, wait); + mono_g_hash_table_foreach (threads, collect_and_abort_threads, wait); mono_threads_unlock (); -- 2.25.1