[gjs] context: Don't use a static mutex



commit 3149b9c95344925a248d51981354766e3120d7c1
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 2 13:24:45 2013 -0500

    context: Don't use a static mutex
    
    GMutex works just as well, and isn't deprecated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691028

 gjs/context.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gjs/context.c b/gjs/context.c
index f3a381e..22b6307 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -98,7 +98,7 @@ enum {
 };
 
 
-static GStaticMutex contexts_lock = G_STATIC_MUTEX_INIT;
+static GMutex contexts_lock;
 static GList *all_contexts = NULL;
 
 
@@ -418,9 +418,9 @@ gjs_context_finalize(GObject *object)
 
     g_free(js_context->jsversion_string);
 
-    g_static_mutex_lock(&contexts_lock);
+    g_mutex_lock(&contexts_lock);
     all_contexts = g_list_remove(all_contexts, object);
-    g_static_mutex_unlock(&contexts_lock);
+    g_mutex_unlock(&contexts_lock);
 
     G_OBJECT_CLASS(gjs_context_parent_class)->finalize(object);
 }
@@ -699,9 +699,9 @@ gjs_context_constructor (GType                  type,
 
     JS_EndRequest(js_context->context);
 
-    g_static_mutex_lock (&contexts_lock);
+    g_mutex_lock (&contexts_lock);
     all_contexts = g_list_prepend(all_contexts, object);
-    g_static_mutex_unlock (&contexts_lock);
+    g_mutex_unlock (&contexts_lock);
 
     return object;
 }
@@ -946,11 +946,11 @@ gjs_context_get_all(void)
 {
   GList *result;
   GList *iter;
-  g_static_mutex_lock (&contexts_lock);
+  g_mutex_lock (&contexts_lock);
   result = g_list_copy(all_contexts);
   for (iter = result; iter; iter = iter->next)
     g_object_ref((GObject*)iter->data);
-  g_static_mutex_unlock (&contexts_lock);
+  g_mutex_unlock (&contexts_lock);
   return result;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]