#include <mono/utils/mono-coop-semaphore.h>
#include <mono/utils/hazard-pointer.h>
#include <mono/utils/w32api.h>
+#include <mono/utils/unlocked.h>
+#include <mono/utils/mono-os-wait.h>
#ifndef HOST_WIN32
#include <pthread.h>
mono_gc_finalize_notify ();
/* g_print ("Waiting for pending finalizers....\n"); */
MONO_ENTER_GC_SAFE;
- WaitForSingleObjectEx (pending_done_event, INFINITE, TRUE);
+ mono_win32_wait_for_single_object_ex (pending_done_event, INFINITE, TRUE);
MONO_EXIT_GC_SAFE;
/* g_print ("Done pending....\n"); */
#else
DomainFinalizationReq *req = NULL;
MonoDomain *domain;
- if (domains_to_finalize) {
+ if (UnlockedReadPointer ((gpointer)&domains_to_finalize)) {
mono_finalizer_lock ();
if (domains_to_finalize) {
req = (DomainFinalizationReq *)domains_to_finalize->data;
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));
+ mono_threads_add_joinable_thread (GUINT_TO_POINTER (gc_thread->tid));
break;
}
mono_gc_suspend_finalizers ();
/* Try to abort the thread, in the hope that it is running managed code */
- mono_thread_internal_abort (gc_thread);
+ mono_thread_internal_abort (gc_thread, FALSE);
/* Wait for it to stop */
ret = guarded_wait (gc_thread->handle, 100, FALSE);
g_assert (ret == MONO_THREAD_INFO_WAIT_RET_SUCCESS_0);
- mono_thread_join (GUINT_TO_POINTER (gc_thread->tid));
+ mono_threads_add_joinable_thread (GUINT_TO_POINTER (gc_thread->tid));
break;
}