[PATCH spice-gtk 1/4] Use GMutex instead of GStaticMutex

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

 



Since GLib 2.32 GMutex can be statically allocated, so GStaticMutex has
been deprecated.
---
 src/desktop-integration.c |  6 +++---
 src/spice-gtk-session.c   |  6 +++---
 src/spice-session.c       | 12 ++++++------
 src/usbutil.c             |  6 +++---
 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;
 }
 
-- 
2.8.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]