diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-10-03 23:26:55 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-10-04 11:13:46 -0400 |
commit | 5f48e2cde5cb2871abb4e07b16140f52244d36ff (patch) | |
tree | 49b191cc0d5d352d1eefbf0db638523ad3d5263b /gio/gdbusobjectproxy.c | |
parent | e03db42792220e75fe7587f6c37493fd071e2b65 (diff) | |
download | glib-5f48e2cde5cb2871abb4e07b16140f52244d36ff.tar.gz |
GDBus: switch to struct-embedded GMutex and GCond
Now that we have those, we should use them.
https://bugzilla.gnome.org/show_bug.cgi?id=660739
Diffstat (limited to 'gio/gdbusobjectproxy.c')
-rw-r--r-- | gio/gdbusobjectproxy.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/gio/gdbusobjectproxy.c b/gio/gdbusobjectproxy.c index c2dd2bbb2..2d1830113 100644 --- a/gio/gdbusobjectproxy.c +++ b/gio/gdbusobjectproxy.c @@ -46,7 +46,7 @@ struct _GDBusObjectProxyPrivate { - GMutex *lock; + GMutex lock; GHashTable *map_name_to_iface; gchar *object_path; GDBusConnection *connection; @@ -71,7 +71,7 @@ g_dbus_object_proxy_finalize (GObject *object) g_hash_table_unref (proxy->priv->map_name_to_iface); - g_mutex_free (proxy->priv->lock); + g_mutex_clear (&proxy->priv->lock); if (G_OBJECT_CLASS (g_dbus_object_proxy_parent_class)->finalize != NULL) G_OBJECT_CLASS (g_dbus_object_proxy_parent_class)->finalize (object); @@ -88,9 +88,9 @@ g_dbus_object_proxy_get_property (GObject *object, switch (prop_id) { case PROP_G_OBJECT_PATH: - g_mutex_lock (proxy->priv->lock); + g_mutex_lock (&proxy->priv->lock); g_value_set_string (value, proxy->priv->object_path); - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); break; case PROP_G_CONNECTION: @@ -114,15 +114,15 @@ g_dbus_object_proxy_set_property (GObject *object, switch (prop_id) { case PROP_G_OBJECT_PATH: - g_mutex_lock (proxy->priv->lock); + g_mutex_lock (&proxy->priv->lock); proxy->priv->object_path = g_value_dup_string (value); - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); break; case PROP_G_CONNECTION: - g_mutex_lock (proxy->priv->lock); + g_mutex_lock (&proxy->priv->lock); proxy->priv->connection = g_value_dup_object (value); - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); break; default: @@ -183,7 +183,7 @@ g_dbus_object_proxy_init (GDBusObjectProxy *proxy) proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, G_TYPE_DBUS_OBJECT_PROXY, GDBusObjectProxyPrivate); - proxy->priv->lock = g_mutex_new (); + g_mutex_init (&proxy->priv->lock); proxy->priv->map_name_to_iface = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, @@ -195,9 +195,9 @@ g_dbus_object_proxy_get_object_path (GDBusObject *object) { GDBusObjectProxy *proxy = G_DBUS_OBJECT_PROXY (object); const gchar *ret; - g_mutex_lock (proxy->priv->lock); + g_mutex_lock (&proxy->priv->lock); ret = proxy->priv->object_path; - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); return ret; } @@ -217,9 +217,9 @@ g_dbus_object_proxy_get_connection (GDBusObjectProxy *proxy) { GDBusConnection *ret; g_return_val_if_fail (G_IS_DBUS_OBJECT_PROXY (proxy), NULL); - g_mutex_lock (proxy->priv->lock); + g_mutex_lock (&proxy->priv->lock); ret = proxy->priv->connection; - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); return ret; } @@ -233,11 +233,11 @@ g_dbus_object_proxy_get_interface (GDBusObject *object, g_return_val_if_fail (G_IS_DBUS_OBJECT_PROXY (proxy), NULL); g_return_val_if_fail (g_dbus_is_interface_name (interface_name), NULL); - g_mutex_lock (proxy->priv->lock); + g_mutex_lock (&proxy->priv->lock); ret = g_hash_table_lookup (proxy->priv->map_name_to_iface, interface_name); if (ret != NULL) g_object_ref (ret); - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); return (GDBusInterface *) ret; /* TODO: proper cast */ } @@ -252,10 +252,10 @@ g_dbus_object_proxy_get_interfaces (GDBusObject *object) ret = NULL; - g_mutex_lock (proxy->priv->lock); + g_mutex_lock (&proxy->priv->lock); ret = g_hash_table_get_values (proxy->priv->map_name_to_iface); g_list_foreach (ret, (GFunc) g_object_ref, NULL); - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); return ret; } @@ -296,7 +296,7 @@ _g_dbus_object_proxy_add_interface (GDBusObjectProxy *proxy, g_return_if_fail (G_IS_DBUS_OBJECT_PROXY (proxy)); g_return_if_fail (G_IS_DBUS_PROXY (interface_proxy)); - g_mutex_lock (proxy->priv->lock); + g_mutex_lock (&proxy->priv->lock); interface_name = g_dbus_proxy_get_interface_name (interface_proxy); interface_proxy_to_remove = g_hash_table_lookup (proxy->priv->map_name_to_iface, interface_name); @@ -310,7 +310,7 @@ _g_dbus_object_proxy_add_interface (GDBusObjectProxy *proxy, g_object_ref (interface_proxy)); g_object_ref (interface_proxy); - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); if (interface_proxy_to_remove != NULL) { @@ -331,20 +331,20 @@ _g_dbus_object_proxy_remove_interface (GDBusObjectProxy *proxy, g_return_if_fail (G_IS_DBUS_OBJECT_PROXY (proxy)); g_return_if_fail (g_dbus_is_interface_name (interface_name)); - g_mutex_lock (proxy->priv->lock); + g_mutex_lock (&proxy->priv->lock); interface_proxy = g_hash_table_lookup (proxy->priv->map_name_to_iface, interface_name); if (interface_proxy != NULL) { g_object_ref (interface_proxy); g_warn_if_fail (g_hash_table_remove (proxy->priv->map_name_to_iface, interface_name)); - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); g_signal_emit_by_name (proxy, "interface-removed", interface_proxy); g_object_unref (interface_proxy); } else { - g_mutex_unlock (proxy->priv->lock); + g_mutex_unlock (&proxy->priv->lock); } } |