[Cogl] [PATCH] core: Don't use g_once_*() API

Damien Lespiau damien.lespiau at gmail.com
Wed Sep 12 15:48:54 PDT 2012


From: Damien Lespiau <damien.lespiau at intel.com>

As Cogl is not thread safe, we don't really need a thread safe
cogl_init() function.

This also reduces the amount of dependency cogl has on glib, handy when
we want to create a standalone version of cogl, some day.
---
 cogl/cogl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cogl/cogl.c b/cogl/cogl.c
index a3e11e4..280b157 100644
--- a/cogl/cogl.c
+++ b/cogl/cogl.c
@@ -212,9 +212,9 @@ _cogl_system_error_domain (void)
 void
 _cogl_init (void)
 {
-  static size_t init_status = 0;
+  static CoglBool initialized = FALSE;
 
-  if (g_once_init_enter (&init_status))
+  if (initialized == FALSE)
     {
       bindtextdomain (GETTEXT_PACKAGE, COGL_LOCALEDIR);
       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -223,7 +223,7 @@ _cogl_init (void)
 
       _cogl_config_read ();
       _cogl_debug_check_environment ();
-      g_once_init_leave (&init_status, 1);
+      initialized = TRUE;
     }
 }
 
-- 
1.7.7.5



More information about the Cogl mailing list