[glib/wip/mutexes] Port internal GStaticRecMutex users to GRecMutex
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/mutexes] Port internal GStaticRecMutex users to GRecMutex
- Date: Wed, 21 Sep 2011 18:58:38 +0000 (UTC)
commit 9a393f11eb1644e9e14b3353c27d1c7ffe6b54d9
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Sep 21 14:37:34 2011 -0400
Port internal GStaticRecMutex users to GRecMutex
gio/gunionvolumemonitor.c | 38 +++++++++++++++++++-------------------
glib/gvarianttypeinfo.c | 12 ++++++------
gmodule/gmodule.c | 20 ++++++++++----------
gobject/gtype.c | 22 +++++++++++-----------
4 files changed, 46 insertions(+), 46 deletions(-)
---
diff --git a/gio/gunionvolumemonitor.c b/gio/gunionvolumemonitor.c
index 931846e..6d9b21b 100644
--- a/gio/gunionvolumemonitor.c
+++ b/gio/gunionvolumemonitor.c
@@ -52,7 +52,7 @@ static void g_union_volume_monitor_remove_monitor (GUnionVolumeMonitor *union_mo
#define g_union_volume_monitor_get_type _g_union_volume_monitor_get_type
G_DEFINE_TYPE (GUnionVolumeMonitor, g_union_volume_monitor, G_TYPE_VOLUME_MONITOR);
-static GStaticRecMutex the_volume_monitor_mutex = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex the_volume_monitor_mutex = G_REC_MUTEX_INIT;
static GUnionVolumeMonitor *the_volume_monitor = NULL;
@@ -84,7 +84,7 @@ g_union_volume_monitor_dispose (GObject *object)
monitor = G_UNION_VOLUME_MONITOR (object);
- g_static_rec_mutex_lock (&the_volume_monitor_mutex);
+ g_rec_mutex_lock (&the_volume_monitor_mutex);
the_volume_monitor = NULL;
for (l = monitor->monitors; l != NULL; l = l->next)
@@ -93,7 +93,7 @@ g_union_volume_monitor_dispose (GObject *object)
g_object_run_dispose (G_OBJECT (child_monitor));
}
- g_static_rec_mutex_unlock (&the_volume_monitor_mutex);
+ g_rec_mutex_unlock (&the_volume_monitor_mutex);
G_OBJECT_CLASS (g_union_volume_monitor_parent_class)->dispose (object);
}
@@ -110,7 +110,7 @@ get_mounts (GVolumeMonitor *volume_monitor)
res = NULL;
- g_static_rec_mutex_lock (&the_volume_monitor_mutex);
+ g_rec_mutex_lock (&the_volume_monitor_mutex);
for (l = monitor->monitors; l != NULL; l = l->next)
{
@@ -119,7 +119,7 @@ get_mounts (GVolumeMonitor *volume_monitor)
res = g_list_concat (res, g_volume_monitor_get_mounts (child_monitor));
}
- g_static_rec_mutex_unlock (&the_volume_monitor_mutex);
+ g_rec_mutex_unlock (&the_volume_monitor_mutex);
return res;
}
@@ -136,7 +136,7 @@ get_volumes (GVolumeMonitor *volume_monitor)
res = NULL;
- g_static_rec_mutex_lock (&the_volume_monitor_mutex);
+ g_rec_mutex_lock (&the_volume_monitor_mutex);
for (l = monitor->monitors; l != NULL; l = l->next)
{
@@ -145,7 +145,7 @@ get_volumes (GVolumeMonitor *volume_monitor)
res = g_list_concat (res, g_volume_monitor_get_volumes (child_monitor));
}
- g_static_rec_mutex_unlock (&the_volume_monitor_mutex);
+ g_rec_mutex_unlock (&the_volume_monitor_mutex);
return res;
}
@@ -162,7 +162,7 @@ get_connected_drives (GVolumeMonitor *volume_monitor)
res = NULL;
- g_static_rec_mutex_lock (&the_volume_monitor_mutex);
+ g_rec_mutex_lock (&the_volume_monitor_mutex);
for (l = monitor->monitors; l != NULL; l = l->next)
{
@@ -171,7 +171,7 @@ get_connected_drives (GVolumeMonitor *volume_monitor)
res = g_list_concat (res, g_volume_monitor_get_connected_drives (child_monitor));
}
- g_static_rec_mutex_unlock (&the_volume_monitor_mutex);
+ g_rec_mutex_unlock (&the_volume_monitor_mutex);
return res;
}
@@ -188,7 +188,7 @@ get_volume_for_uuid (GVolumeMonitor *volume_monitor, const char *uuid)
volume = NULL;
- g_static_rec_mutex_lock (&the_volume_monitor_mutex);
+ g_rec_mutex_lock (&the_volume_monitor_mutex);
for (l = monitor->monitors; l != NULL; l = l->next)
{
@@ -200,7 +200,7 @@ get_volume_for_uuid (GVolumeMonitor *volume_monitor, const char *uuid)
}
- g_static_rec_mutex_unlock (&the_volume_monitor_mutex);
+ g_rec_mutex_unlock (&the_volume_monitor_mutex);
return volume;
}
@@ -217,7 +217,7 @@ get_mount_for_uuid (GVolumeMonitor *volume_monitor, const char *uuid)
mount = NULL;
- g_static_rec_mutex_lock (&the_volume_monitor_mutex);
+ g_rec_mutex_lock (&the_volume_monitor_mutex);
for (l = monitor->monitors; l != NULL; l = l->next)
{
@@ -229,7 +229,7 @@ get_mount_for_uuid (GVolumeMonitor *volume_monitor, const char *uuid)
}
- g_static_rec_mutex_unlock (&the_volume_monitor_mutex);
+ g_rec_mutex_unlock (&the_volume_monitor_mutex);
return mount;
}
@@ -563,7 +563,7 @@ g_volume_monitor_get (void)
{
GVolumeMonitor *vm;
- g_static_rec_mutex_lock (&the_volume_monitor_mutex);
+ g_rec_mutex_lock (&the_volume_monitor_mutex);
if (the_volume_monitor)
vm = G_VOLUME_MONITOR (g_object_ref (the_volume_monitor));
@@ -574,7 +574,7 @@ g_volume_monitor_get (void)
vm = G_VOLUME_MONITOR (the_volume_monitor);
}
- g_static_rec_mutex_unlock (&the_volume_monitor_mutex);
+ g_rec_mutex_unlock (&the_volume_monitor_mutex);
return vm;
}
@@ -594,9 +594,9 @@ _g_mount_get_for_mount_path (const gchar *mount_path,
if (klass->get_mount_for_mount_path)
{
- g_static_rec_mutex_lock (&the_volume_monitor_mutex);
+ g_rec_mutex_lock (&the_volume_monitor_mutex);
mount = klass->get_mount_for_mount_path (mount_path, cancellable);
- g_static_rec_mutex_unlock (&the_volume_monitor_mutex);
+ g_rec_mutex_unlock (&the_volume_monitor_mutex);
}
/* TODO: How do we know this succeeded? Keep in mind that the native
@@ -669,7 +669,7 @@ g_volume_monitor_adopt_orphan_mount (GMount *mount)
volume = NULL;
- g_static_rec_mutex_lock (&the_volume_monitor_mutex);
+ g_rec_mutex_lock (&the_volume_monitor_mutex);
for (l = the_volume_monitor->monitors; l != NULL; l = l->next)
{
@@ -684,7 +684,7 @@ g_volume_monitor_adopt_orphan_mount (GMount *mount)
}
}
- g_static_rec_mutex_unlock (&the_volume_monitor_mutex);
+ g_rec_mutex_unlock (&the_volume_monitor_mutex);
return volume;
}
diff --git a/glib/gvarianttypeinfo.c b/glib/gvarianttypeinfo.c
index 7252459..6ac37d5 100644
--- a/glib/gvarianttypeinfo.c
+++ b/glib/gvarianttypeinfo.c
@@ -709,7 +709,7 @@ g_variant_type_info_member_info (GVariantTypeInfo *info,
}
/* == new/ref/unref == */
-static GStaticRecMutex g_variant_type_info_lock = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex g_variant_type_info_lock = G_REC_MUTEX_INIT;
static GHashTable *g_variant_type_info_table;
/* < private >
@@ -742,7 +742,7 @@ g_variant_type_info_get (const GVariantType *type)
type_string = g_variant_type_dup_string (type);
- g_static_rec_mutex_lock (&g_variant_type_info_lock);
+ g_rec_mutex_lock (&g_variant_type_info_lock);
if (g_variant_type_info_table == NULL)
g_variant_type_info_table = g_hash_table_new (g_str_hash,
@@ -773,7 +773,7 @@ g_variant_type_info_get (const GVariantType *type)
else
g_variant_type_info_ref (info);
- g_static_rec_mutex_unlock (&g_variant_type_info_lock);
+ g_rec_mutex_unlock (&g_variant_type_info_lock);
g_variant_type_info_check (info, 0);
g_free (type_string);
@@ -834,7 +834,7 @@ g_variant_type_info_unref (GVariantTypeInfo *info)
{
ContainerInfo *container = (ContainerInfo *) info;
- g_static_rec_mutex_lock (&g_variant_type_info_lock);
+ g_rec_mutex_lock (&g_variant_type_info_lock);
if (g_atomic_int_dec_and_test (&container->ref_count))
{
g_hash_table_remove (g_variant_type_info_table,
@@ -844,7 +844,7 @@ g_variant_type_info_unref (GVariantTypeInfo *info)
g_hash_table_unref (g_variant_type_info_table);
g_variant_type_info_table = NULL;
}
- g_static_rec_mutex_unlock (&g_variant_type_info_lock);
+ g_rec_mutex_unlock (&g_variant_type_info_lock);
g_free (container->type_string);
@@ -858,7 +858,7 @@ g_variant_type_info_unref (GVariantTypeInfo *info)
g_assert_not_reached ();
}
else
- g_static_rec_mutex_unlock (&g_variant_type_info_lock);
+ g_rec_mutex_unlock (&g_variant_type_info_lock);
}
}
diff --git a/gmodule/gmodule.c b/gmodule/gmodule.c
index 985e7ad..4d7e811 100644
--- a/gmodule/gmodule.c
+++ b/gmodule/gmodule.c
@@ -326,7 +326,7 @@ _g_module_debug_init (void)
module_debug_initialized = TRUE;
}
-static GStaticRecMutex g_module_global_lock = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex g_module_global_lock = G_REC_MUTEX_INIT;
GModule*
g_module_open (const gchar *file_name,
@@ -338,7 +338,7 @@ g_module_open (const gchar *file_name,
SUPPORT_OR_RETURN (NULL);
- g_static_rec_mutex_lock (&g_module_global_lock);
+ g_rec_mutex_lock (&g_module_global_lock);
if (G_UNLIKELY (!module_debug_initialized))
_g_module_debug_init ();
@@ -368,7 +368,7 @@ g_module_open (const gchar *file_name,
else
main_module->ref_count++;
- g_static_rec_mutex_unlock (&g_module_global_lock);
+ g_rec_mutex_unlock (&g_module_global_lock);
return main_module;
}
@@ -378,7 +378,7 @@ g_module_open (const gchar *file_name,
{
module->ref_count++;
- g_static_rec_mutex_unlock (&g_module_global_lock);
+ g_rec_mutex_unlock (&g_module_global_lock);
return module;
}
@@ -461,7 +461,7 @@ g_module_open (const gchar *file_name,
module->ref_count++;
g_module_set_error (NULL);
- g_static_rec_mutex_unlock (&g_module_global_lock);
+ g_rec_mutex_unlock (&g_module_global_lock);
return module;
}
@@ -511,7 +511,7 @@ g_module_open (const gchar *file_name,
(module_debug_flags & G_MODULE_DEBUG_RESIDENT_MODULES))
g_module_make_resident (module);
- g_static_rec_mutex_unlock (&g_module_global_lock);
+ g_rec_mutex_unlock (&g_module_global_lock);
return module;
}
@@ -541,7 +541,7 @@ g_module_close (GModule *module)
g_return_val_if_fail (module != NULL, FALSE);
g_return_val_if_fail (module->ref_count > 0, FALSE);
- g_static_rec_mutex_lock (&g_module_global_lock);
+ g_rec_mutex_lock (&g_module_global_lock);
module->ref_count--;
@@ -585,7 +585,7 @@ g_module_close (GModule *module)
g_free (module);
}
- g_static_rec_mutex_unlock (&g_module_global_lock);
+ g_rec_mutex_unlock (&g_module_global_lock);
return g_module_error() == NULL;
}
@@ -618,7 +618,7 @@ g_module_symbol (GModule *module,
g_return_val_if_fail (symbol_name != NULL, FALSE);
g_return_val_if_fail (symbol != NULL, FALSE);
- g_static_rec_mutex_lock (&g_module_global_lock);
+ g_rec_mutex_lock (&g_module_global_lock);
#ifdef G_MODULE_NEED_USCORE
{
@@ -643,7 +643,7 @@ g_module_symbol (GModule *module,
*symbol = NULL;
}
- g_static_rec_mutex_unlock (&g_module_global_lock);
+ g_rec_mutex_unlock (&g_module_global_lock);
return !module_error;
}
diff --git a/gobject/gtype.c b/gobject/gtype.c
index 0cbb06f..218b2fd 100644
--- a/gobject/gtype.c
+++ b/gobject/gtype.c
@@ -369,7 +369,7 @@ typedef struct {
/* --- variables --- */
static GStaticRWLock type_rw_lock = G_STATIC_RW_LOCK_INIT;
-static GStaticRecMutex class_init_rec_mutex = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex class_init_rec_mutex = G_REC_MUTEX_INIT;
static guint static_n_class_cache_funcs = 0;
static ClassCacheFunc *static_class_cache_funcs = NULL;
static guint static_n_iface_check_funcs = 0;
@@ -2416,11 +2416,11 @@ type_data_unref_U (TypeNode *node,
g_assert (current > 0);
- g_static_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
+ g_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
G_WRITE_LOCK (&type_rw_lock);
type_data_last_unref_Wm (node, uncached);
G_WRITE_UNLOCK (&type_rw_lock);
- g_static_rec_mutex_unlock (&class_init_rec_mutex);
+ g_rec_mutex_unlock (&class_init_rec_mutex);
return;
}
} while (!g_atomic_int_compare_and_exchange ((int *) &node->ref_count, current, current - 1));
@@ -2804,7 +2804,7 @@ g_type_add_interface_static (GType instance_type,
* class initialized, however this function is rarely enough called to take
* the simple route and always acquire class_init_rec_mutex.
*/
- g_static_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
+ g_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
G_WRITE_LOCK (&type_rw_lock);
if (check_add_interface_L (instance_type, interface_type))
{
@@ -2814,7 +2814,7 @@ g_type_add_interface_static (GType instance_type,
type_add_interface_Wm (node, iface, info, NULL);
}
G_WRITE_UNLOCK (&type_rw_lock);
- g_static_rec_mutex_unlock (&class_init_rec_mutex);
+ g_rec_mutex_unlock (&class_init_rec_mutex);
}
/**
@@ -2842,7 +2842,7 @@ g_type_add_interface_dynamic (GType instance_type,
return;
/* see comment in g_type_add_interface_static() about class_init_rec_mutex */
- g_static_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
+ g_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
G_WRITE_LOCK (&type_rw_lock);
if (check_add_interface_L (instance_type, interface_type))
{
@@ -2850,7 +2850,7 @@ g_type_add_interface_dynamic (GType instance_type,
type_add_interface_Wm (node, iface, NULL, plugin);
}
G_WRITE_UNLOCK (&type_rw_lock);
- g_static_rec_mutex_unlock (&class_init_rec_mutex);
+ g_rec_mutex_unlock (&class_init_rec_mutex);
}
@@ -2897,7 +2897,7 @@ g_type_class_ref (GType type)
* node->data->class.init_state == INITIALIZED, because any
* concurrently running initialization was guarded by class_init_rec_mutex.
*/
- g_static_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
+ g_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
/* we need an initialized parent class for initializing derived classes */
ptype = NODE_PARENT_TYPE (node);
@@ -2916,7 +2916,7 @@ g_type_class_ref (GType type)
if (pclass)
g_type_class_unref (pclass);
- g_static_rec_mutex_unlock (&class_init_rec_mutex);
+ g_rec_mutex_unlock (&class_init_rec_mutex);
return node->data->class.class;
}
@@ -3188,12 +3188,12 @@ g_type_default_interface_ref (GType g_type)
if (!node->data || !node->data->iface.dflt_vtable)
{
G_WRITE_UNLOCK (&type_rw_lock);
- g_static_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
+ g_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
G_WRITE_LOCK (&type_rw_lock);
node = lookup_type_node_I (g_type);
type_data_ref_Wm (node);
type_iface_ensure_dflt_vtable_Wm (node);
- g_static_rec_mutex_unlock (&class_init_rec_mutex);
+ g_rec_mutex_unlock (&class_init_rec_mutex);
}
else
type_data_ref_Wm (node); /* ref_count >= 1 already */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]