[Spice-commits] src/channel-usbredir.c src/spice-channel-priv.h src/spice-channel.c src/spice-util-priv.h

Frediano Ziglio fziglio at kemper.freedesktop.org
Mon May 23 10:17:55 UTC 2016


 src/channel-usbredir.c   |   10 +++++-----
 src/spice-channel-priv.h |    2 +-
 src/spice-channel.c      |   28 ++++++++++++++--------------
 src/spice-util-priv.h    |    6 ------
 4 files changed, 20 insertions(+), 26 deletions(-)

New commits:
commit ff60ed7afb4c16e69c153b2e1b62d4c8963adeae
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Fri May 20 17:16:37 2016 +0200

    util: remove STATIC_MUTEX macros
    
    They are no longer needed since 0a9ec4ec0.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index c8a2da9..2c5feae 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -78,7 +78,7 @@ struct _SpiceUsbredirChannelPrivate {
     GTask *task;
     SpiceUsbAclHelper *acl_helper;
 #endif
-    STATIC_MUTEX device_connect_mutex;
+    GMutex device_connect_mutex;
 };
 
 static void channel_set_handlers(SpiceChannelClass *klass);
@@ -110,7 +110,7 @@ static void spice_usbredir_channel_init(SpiceUsbredirChannel *channel)
 {
 #ifdef USE_USBREDIR
     channel->priv = SPICE_USBREDIR_CHANNEL_GET_PRIVATE(channel);
-    STATIC_MUTEX_INIT(channel->priv->device_connect_mutex);
+    g_mutex_init(&channel->priv->device_connect_mutex);
 #endif
 }
 
@@ -221,7 +221,7 @@ static void spice_usbredir_channel_finalize(GObject *obj)
     if (channel->priv->host)
         usbredirhost_close(channel->priv->host);
 #ifdef USE_USBREDIR
-    STATIC_MUTEX_CLEAR(channel->priv->device_connect_mutex);
+    g_mutex_clear(&channel->priv->device_connect_mutex);
 #endif
 
     /* Chain up to the parent class */
@@ -657,12 +657,12 @@ static void *usbredir_alloc_lock(void) {
 
 void spice_usbredir_channel_lock(SpiceUsbredirChannel *channel)
 {
-    STATIC_MUTEX_LOCK(channel->priv->device_connect_mutex);
+    g_mutex_lock(&channel->priv->device_connect_mutex);
 }
 
 void spice_usbredir_channel_unlock(SpiceUsbredirChannel *channel)
 {
-    STATIC_MUTEX_UNLOCK(channel->priv->device_connect_mutex);
+    g_mutex_unlock(&channel->priv->device_connect_mutex);
 }
 
 static void usbredir_lock_lock(void *user_data) {
diff --git a/src/spice-channel-priv.h b/src/spice-channel-priv.h
index 526b661..50aca5c 100644
--- a/src/spice-channel-priv.h
+++ b/src/spice-channel-priv.h
@@ -109,7 +109,7 @@ struct _SpiceChannelPrivate {
 
     GQueue                      xmit_queue;
     gboolean                    xmit_queue_blocked;
-    STATIC_MUTEX                xmit_queue_lock;
+    GMutex                      xmit_queue_lock;
     guint                       xmit_queue_wakeup_id;
     guint64                     xmit_queue_size;
 
diff --git a/src/spice-channel.c b/src/spice-channel.c
index e81034f..35a2cae 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -122,7 +122,7 @@ static void spice_channel_init(SpiceChannel *channel)
     spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_AUTH_SASL);
 #endif
     g_queue_init(&c->xmit_queue);
-    STATIC_MUTEX_INIT(c->xmit_queue_lock);
+    g_mutex_init(&c->xmit_queue_lock);
 }
 
 static void spice_channel_constructed(GObject *gobject)
@@ -173,7 +173,7 @@ static void spice_channel_finalize(GObject *gobject)
 
     g_idle_remove_by_data(gobject);
 
-    STATIC_MUTEX_CLEAR(c->xmit_queue_lock);
+    g_mutex_clear(&c->xmit_queue_lock);
 
     if (c->caps)
         g_array_free(c->caps, TRUE);
@@ -681,9 +681,9 @@ static gboolean spice_channel_idle_wakeup(gpointer user_data)
      *   5) xmit_queue_wakeup_id now says there is a wakeup pending which is
      *      false
      */
-    STATIC_MUTEX_LOCK(c->xmit_queue_lock);
+    g_mutex_lock(&c->xmit_queue_lock);
     c->xmit_queue_wakeup_id = 0;
-    STATIC_MUTEX_UNLOCK(c->xmit_queue_lock);
+    g_mutex_unlock(&c->xmit_queue_lock);
 
     spice_channel_wakeup(channel, FALSE);
 
@@ -703,7 +703,7 @@ void spice_msg_out_send(SpiceMsgOut *out)
     c = out->channel->priv;
     size = spice_marshaller_get_total_size(out->marshaller);
 
-    STATIC_MUTEX_LOCK(c->xmit_queue_lock);
+    g_mutex_lock(&c->xmit_queue_lock);
     if (c->xmit_queue_blocked) {
         g_warning("message queue is blocked, dropping message");
         goto end;
@@ -724,7 +724,7 @@ void spice_msg_out_send(SpiceMsgOut *out)
     }
 
 end:
-    STATIC_MUTEX_UNLOCK(c->xmit_queue_lock);
+    g_mutex_unlock(&c->xmit_queue_lock);
 }
 
 /* coroutine context */
@@ -2200,9 +2200,9 @@ static void spice_channel_iterate_write(SpiceChannel *channel)
     SpiceMsgOut *out;
 
     do {
-        STATIC_MUTEX_LOCK(c->xmit_queue_lock);
+        g_mutex_lock(&c->xmit_queue_lock);
         out = g_queue_pop_head(&c->xmit_queue);
-        STATIC_MUTEX_UNLOCK(c->xmit_queue_lock);
+        g_mutex_unlock(&c->xmit_queue_lock);
         if (out) {
             guint32 size = spice_marshaller_get_total_size(out->marshaller);
             c->xmit_queue_size = (c->xmit_queue_size < size) ? 0 : c->xmit_queue_size - size;
@@ -2723,7 +2723,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
     g_clear_pointer(&c->peer_msg, g_free);
     c->peer_pos = 0;
 
-    STATIC_MUTEX_LOCK(c->xmit_queue_lock);
+    g_mutex_lock(&c->xmit_queue_lock);
     c->xmit_queue_blocked = TRUE; /* Disallow queuing new messages */
     gboolean was_empty = g_queue_is_empty(&c->xmit_queue);
     g_queue_foreach(&c->xmit_queue, (GFunc)spice_msg_out_unref, NULL);
@@ -2732,7 +2732,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
         g_source_remove(c->xmit_queue_wakeup_id);
         c->xmit_queue_wakeup_id = 0;
     }
-    STATIC_MUTEX_UNLOCK(c->xmit_queue_lock);
+    g_mutex_unlock(&c->xmit_queue_lock);
     spice_channel_flushed(channel, was_empty);
 
     g_array_set_size(c->remote_common_caps, 0);
@@ -2915,9 +2915,9 @@ guint64 spice_channel_get_queue_size (SpiceChannel *channel)
 {
     guint64 size;
     SpiceChannelPrivate *c = channel->priv;
-    STATIC_MUTEX_LOCK(c->xmit_queue_lock);
+    g_mutex_lock(&c->xmit_queue_lock);
     size = c->xmit_queue_size;
-    STATIC_MUTEX_UNLOCK(c->xmit_queue_lock);
+    g_mutex_unlock(&c->xmit_queue_lock);
     return size;
 }
 
@@ -3041,9 +3041,9 @@ void spice_channel_flush_async(SpiceChannel *self, GCancellable *cancellable,
 
     task = g_task_new(self, cancellable, callback, user_data);
 
-    STATIC_MUTEX_LOCK(c->xmit_queue_lock);
+    g_mutex_lock(&c->xmit_queue_lock);
     was_empty = g_queue_is_empty(&c->xmit_queue);
-    STATIC_MUTEX_UNLOCK(c->xmit_queue_lock);
+    g_mutex_unlock(&c->xmit_queue_lock);
     if (was_empty) {
         g_task_return_boolean(task, TRUE);
         g_object_unref(task);
diff --git a/src/spice-util-priv.h b/src/spice-util-priv.h
index 811d61a..d5e1b8a 100644
--- a/src/spice-util-priv.h
+++ b/src/spice-util-priv.h
@@ -33,12 +33,6 @@ gchar* spice_dos2unix(const gchar *str, gssize len, GError **error);
 void spice_mono_edge_highlight(unsigned width, unsigned hight,
                                const guint8 *and, const guint8 *xor, guint8 *dest);
 
-#define STATIC_MUTEX            GMutex
-#define STATIC_MUTEX_INIT(m)    g_mutex_init(&(m))
-#define STATIC_MUTEX_CLEAR(m)   g_mutex_clear(&(m))
-#define STATIC_MUTEX_LOCK(m)    g_mutex_lock(&(m))
-#define STATIC_MUTEX_UNLOCK(m)  g_mutex_unlock(&(m))
-
 G_END_DECLS
 
 #endif /* SPICE_UTIL_PRIV_H */


More information about the Spice-commits mailing list