summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Grunt <pgrunt@redhat.com>2016-04-06 15:40:09 +0200
committerPavel Grunt <pgrunt@redhat.com>2016-04-07 11:53:24 +0200
commit6eb50944b2a082ec0d0e83a4d1f6a338e2956285 (patch)
tree7a58e07057db23ceab3cefe48724462d3a7cdfda
parent60d81a2936597cbf968e75ce590aa526c17b125e (diff)
Use GMutex instead of GStaticMutex
Since GLib 2.32 GMutex can be statically allocated, so GStaticMutex has been deprecated. Acked-by: Christophe Fergeau <cfergeau@redhat.com>
-rw-r--r--src/desktop-integration.c6
-rw-r--r--src/spice-gtk-session.c6
-rw-r--r--src/spice-session.c12
-rw-r--r--src/usbutil.c6
4 files changed, 15 insertions, 15 deletions
diff --git a/src/desktop-integration.c b/src/desktop-integration.c
index 01300e8..529fb05 100644
--- a/src/desktop-integration.c
+++ b/src/desktop-integration.c
@@ -196,17 +196,17 @@ static void spice_desktop_integration_class_init(SpiceDesktopIntegrationClass *k
SpiceDesktopIntegration *spice_desktop_integration_get(SpiceSession *session)
{
SpiceDesktopIntegration *self;
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ static GMutex mutex;
g_return_val_if_fail(session != NULL, NULL);
- g_static_mutex_lock(&mutex);
+ g_mutex_lock(&mutex);
self = g_object_get_data(G_OBJECT(session), "spice-desktop");
if (self == NULL) {
self = g_object_new(SPICE_TYPE_DESKTOP_INTEGRATION, NULL);
g_object_set_data_full(G_OBJECT(session), "spice-desktop", self, g_object_unref);
}
- g_static_mutex_unlock(&mutex);
+ g_mutex_unlock(&mutex);
return self;
}
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 380b0bb..7370599 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -1133,15 +1133,15 @@ SpiceGtkSession *spice_gtk_session_get(SpiceSession *session)
g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
SpiceGtkSession *self;
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ static GMutex mutex;
- g_static_mutex_lock(&mutex);
+ g_mutex_lock(&mutex);
self = g_object_get_data(G_OBJECT(session), "spice-gtk-session");
if (self == NULL) {
self = g_object_new(SPICE_TYPE_GTK_SESSION, "session", session, NULL);
g_object_set_data_full(G_OBJECT(session), "spice-gtk-session", self, g_object_unref);
}
- g_static_mutex_unlock(&mutex);
+ g_mutex_unlock(&mutex);
return SPICE_GTK_SESSION(self);
}
diff --git a/src/spice-session.c b/src/spice-session.c
index 6a0edae..9bf3f40 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -2641,18 +2641,18 @@ SpiceURI *spice_session_get_proxy_uri(SpiceSession *session)
**/
SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ static GMutex mutex;
SpiceAudio *self;
g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
- g_static_mutex_lock(&mutex);
+ g_mutex_lock(&mutex);
self = session->priv->audio_manager;
if (self == NULL) {
self = spice_audio_new(session, context, NULL);
session->priv->audio_manager = self;
}
- g_static_mutex_unlock(&mutex);
+ g_mutex_unlock(&mutex);
return self;
}
@@ -2675,19 +2675,19 @@ SpiceUsbDeviceManager *spice_usb_device_manager_get(SpiceSession *session,
GError **err)
{
SpiceUsbDeviceManager *self;
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ static GMutex mutex;
g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
g_return_val_if_fail(err == NULL || *err == NULL, NULL);
- g_static_mutex_lock(&mutex);
+ g_mutex_lock(&mutex);
self = session->priv->usb_manager;
if (self == NULL) {
self = g_initable_new(SPICE_TYPE_USB_DEVICE_MANAGER, NULL, err,
"session", session, NULL);
session->priv->usb_manager = self;
}
- g_static_mutex_unlock(&mutex);
+ g_mutex_unlock(&mutex);
return self;
}
diff --git a/src/usbutil.c b/src/usbutil.c
index 24330b2..6cd8148 100644
--- a/src/usbutil.c
+++ b/src/usbutil.c
@@ -51,7 +51,7 @@ typedef struct _usb_vendor_info {
char name[VENDOR_NAME_LEN];
} usb_vendor_info;
-static GStaticMutex usbids_load_mutex = G_STATIC_MUTEX_INIT;
+static GMutex usbids_load_mutex;
static int usbids_vendor_count = 0; /* < 0: failed, 0: empty, > 0: loaded */
static usb_vendor_info *usbids_vendor_info = NULL;
@@ -215,7 +215,7 @@ static gboolean spice_usbutil_load_usbids(void)
{
gboolean success = FALSE;
- g_static_mutex_lock(&usbids_load_mutex);
+ g_mutex_lock(&usbids_load_mutex);
if (usbids_vendor_count) {
success = usbids_vendor_count > 0;
goto leave;
@@ -242,7 +242,7 @@ static gboolean spice_usbutil_load_usbids(void)
#endif
leave:
- g_static_mutex_unlock(&usbids_load_mutex);
+ g_mutex_unlock(&usbids_load_mutex);
return success;
}