[runtime] Use mono_thread_join () to wait for the finalizer thread to exit.
authorZoltan Varga <vargaz@gmail.com>
Fri, 31 Jan 2014 05:43:32 +0000 (06:43 +0100)
committerZoltan Varga <vargaz@gmail.com>
Fri, 31 Jan 2014 05:43:32 +0000 (06:43 +0100)
mono/metadata/gc.c

index ff7b90181aabe1c92eb9f566c1033e395777ad34..6ad2c6fa1827064176ee131b0c73c6f593ae5883 100644 (file)
@@ -1209,14 +1209,7 @@ mono_gc_cleanup (void)
                                ret = WaitForSingleObjectEx (gc_thread->handle, INFINITE, TRUE);
                                g_assert (ret == WAIT_OBJECT_0);
 
-#ifndef HOST_WIN32
-                               /*
-                                * The above wait only waits for the exited event to be signalled, the thread might still be running. To fix this race, we
-                                * create the finalizer thread without calling pthread_detach () on it, so we can wait for it manually.
-                                */
-                               ret = pthread_join ((MonoNativeThreadId)(gpointer)(gsize)gc_thread->tid, NULL);
-                               g_assert (ret == 0);
-#endif
+                               mono_thread_join ((gpointer)gc_thread->tid);
                        }
                }
                gc_thread = NULL;