[threads] Print more information in case of error in global suspend
authorLudovic Henry <ludovic@xamarin.com>
Thu, 22 Oct 2015 10:39:31 +0000 (11:39 +0100)
committerLudovic Henry <ludovic@xamarin.com>
Thu, 22 Oct 2015 10:40:43 +0000 (11:40 +0100)
mono/utils/mono-threads.c

index 1c1a1842eb2f9e5a965431547e4220a50eb3ec16..6bfd46cc3ef1f56ab2185c9bf28220f8807032b8 100644 (file)
@@ -134,7 +134,9 @@ mono_threads_add_to_pending_operation_set (MonoThreadInfo* info)
 void
 mono_threads_begin_global_suspend (void)
 {
-       g_assert (pending_suspends == 0);
+       size_t ps = pending_suspends;
+       if (G_UNLIKELY (ps != 0))
+               g_error ("pending_suspends = %d, but must be 0", ps);
        THREADS_SUSPEND_DEBUG ("------ BEGIN GLOBAL OP sp %d rp %d ap %d wd %d po %d (sp + rp + ap == wd) (wd == po)\n", suspend_posts, resume_posts,
                abort_posts, waits_done, pending_ops);
        g_assert ((suspend_posts + resume_posts + abort_posts) == waits_done);
@@ -144,7 +146,9 @@ mono_threads_begin_global_suspend (void)
 void
 mono_threads_end_global_suspend (void) 
 {
-       g_assert (pending_suspends == 0);
+       size_t ps = pending_suspends;
+       if (G_UNLIKELY (ps != 0))
+               g_error ("pending_suspends = %d, but must be 0", ps);
        THREADS_SUSPEND_DEBUG ("------ END GLOBAL OP sp %d rp %d ap %d wd %d po %d\n", suspend_posts, resume_posts,
                abort_posts, waits_done, pending_ops);
        g_assert ((suspend_posts + resume_posts + abort_posts) == waits_done);