Merge pull request #2721 from ludovic-henry/fix-mono_ms_ticks
[mono.git] / mono / metadata / gc.c
index bf02f2892b2e8ff3f8c0f544e2c3a08cf4dfa2b5..2cff646db1771c099780ffccbf618800d049a270 100644 (file)
@@ -453,6 +453,8 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
                mono_gc_finalize_threadpool_threads ();
        }
 
+       mono_profiler_appdomain_event (domain, MONO_PROFILE_END_UNLOAD);
+
        return TRUE;
 }
 
@@ -826,7 +828,9 @@ static
 void
 mono_gc_init_finalizer_thread (void)
 {
-       gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, FALSE, 0);
+       MonoError error;
+       gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, FALSE, 0, &error);
+       mono_error_assert_ok (&error);
 }
 
 void
@@ -872,14 +876,14 @@ mono_gc_cleanup (void)
                finished = TRUE;
                if (mono_thread_internal_current () != gc_thread) {
                        gboolean timed_out = FALSE;
-                       guint32 start_ticks = mono_msec_ticks ();
-                       guint32 end_ticks = start_ticks + 2000;
+                       gint64 start_ticks = mono_msec_ticks ();
+                       gint64 end_ticks = start_ticks + 2000;
 
                        mono_gc_finalize_notify ();
                        /* Finishing the finalizer thread, so wait a little bit... */
                        /* MS seems to wait for about 2 seconds */
                        while (!finalizer_thread_exited) {
-                               guint32 current_ticks = mono_msec_ticks ();
+                               gint64 current_ticks = mono_msec_ticks ();
                                guint32 timeout;
 
                                if (current_ticks >= end_ticks)