diff --git a/src/mono/mono/utils/mono-threads-coop.c b/src/mono/mono/utils/mono-threads-coop.c index 44d1ee8681df82..970a7099e9ecfa 100644 --- a/src/mono/mono/utils/mono-threads-coop.c +++ b/src/mono/mono/utils/mono-threads-coop.c @@ -95,12 +95,11 @@ coop_tls_pop (gpointer received_cookie) static void check_info (MonoThreadInfo *info, const gchar *action, const gchar *state, const char *func) { - if (!info) - g_error ("%s Cannot %s GC %s region if the thread is not attached", func, action, state); - if (!mono_thread_info_is_current (info)) - g_error ("%s [%p] Cannot %s GC %s region on a different thread", func, mono_thread_info_get_tid (info), action, state); - if (!mono_thread_info_is_live (info)) - g_error ("%s [%p] Cannot %s GC %s region if the thread is not live", func, mono_thread_info_get_tid (info), action, state); +#ifdef ENABLE_CHECKED_BUILD + g_assertf (info, "%s Cannot %s GC %s region if the thread is not attached", func, action, state); + g_assertf (mono_thread_info_is_current (info), "%s [%p] Cannot %s GC %s region on a different thread", func, mono_thread_info_get_tid (info), action, state); + g_assertf (mono_thread_info_is_live (info), "%s [%p] Cannot %s GC %s region if the thread is not live", func, mono_thread_info_get_tid (info), action, state); +#endif } static int coop_reset_blocking_count; diff --git a/src/mono/mono/utils/mono-threads-state-machine.c b/src/mono/mono/utils/mono-threads-state-machine.c index 2d9a06cd76f61b..927d86d619f23a 100644 --- a/src/mono/mono/utils/mono-threads-state-machine.c +++ b/src/mono/mono/utils/mono-threads-state-machine.c @@ -105,6 +105,7 @@ unwrap_thread_state (MonoThreadInfo* info, static void check_thread_state (MonoThreadInfo* info) { +#ifdef ENABLE_CHECKED_BUILD int raw_state, cur_state, suspend_count; gboolean no_safepoints; UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, no_safepoints, info); @@ -133,6 +134,7 @@ check_thread_state (MonoThreadInfo* info) default: g_error ("Invalid state %d", cur_state); } +#endif } static void