[libsoup] soup-session: fix a concurrency bug

commit bd39b5703f5c58a9097a2c409bf83c222d42fbcb
Author: Dan Winship <danw gnome org>
Date:   Fri May 31 15:25:56 2013 -0300

    soup-session: fix a concurrency bug
    soup_session_kick_queue() should have been locking conn_mutex around
    signalling conn_cond, since otherwise there's a race condition where
    it could signal just before someone else starts waiting. (In reality,
    this is unlikely to cause problems, since we tend to signal conn_cond
    more than is actually necessary. But maybe we'll get better about not
    doing that in the future.)

 libsoup/soup-session.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 066cfde..2ae7249 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -2148,8 +2148,11 @@ soup_session_real_kick_queue (SoupSession *session)
                        have_sync_items = TRUE;
-       if (have_sync_items)
+       if (have_sync_items) {
+               g_mutex_lock (&priv->conn_lock);
                g_cond_broadcast (&priv->conn_cond);
+               g_mutex_unlock (&priv->conn_lock);
+       }

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