[coop] Make mono_threads_is_coop_enabled a normal function
authorAleksey Kliger <aleksey@xamarin.com>
Wed, 18 May 2016 15:19:23 +0000 (11:19 -0400)
committerAleksey Kliger <aleksey@xamarin.com>
Wed, 18 May 2016 15:19:23 +0000 (11:19 -0400)
It doesn't need to live in the header.

In particular is_coop_enabled variable used to be in every translation
unit instead of just a single flag.

mono/utils/mono-threads-coop.c
mono/utils/mono-threads-coop.h

index a327f581e25457c7b45385a13aae97d14f085669..12cef7ddaf74f2299a33fc6290fb05e2c5622865 100644 (file)
@@ -377,6 +377,20 @@ mono_threads_assert_gc_unsafe_region (void)
        MONO_REQ_GC_UNSAFE_MODE;
 }
 
+gboolean
+mono_threads_is_coop_enabled (void)
+{
+#if defined(USE_COOP_GC)
+       return TRUE;
+#else
+       static int is_coop_enabled = -1;
+       if (G_UNLIKELY (is_coop_enabled == -1))
+               is_coop_enabled = g_getenv ("MONO_ENABLE_COOP") != NULL ? 1 : 0;
+       return is_coop_enabled == 1;
+#endif
+}
+
+
 void
 mono_threads_init_coop (void)
 {
index dae50c19c545fdbedfe86eefef1aaadc48c97b7c..3e83a08a4466b3be9385fb44784b27e2cb1f731a 100644 (file)
@@ -23,18 +23,8 @@ extern volatile size_t mono_polling_required;
 
 /* Runtime consumable API */
 
-static gboolean G_GNUC_UNUSED
-mono_threads_is_coop_enabled (void)
-{
-#if defined(USE_COOP_GC)
-       return TRUE;
-#else
-       static gboolean is_coop_enabled = -1;
-       if (G_UNLIKELY (is_coop_enabled == -1))
-               is_coop_enabled = g_getenv ("MONO_ENABLE_COOP") != NULL ? TRUE : FALSE;
-       return is_coop_enabled;
-#endif
-}
+gboolean
+mono_threads_is_coop_enabled (void);
 
 /* Internal API */