[glib] gthreadedresolver: fix hang on g_thread_pool_push() failure



commit a84e6f982f465b31aec7365dadfe2c1ad6664e11
Author: muralis <murali sound gmail com>
Date:   Wed May 25 13:42:59 2011 +0530

    gthreadedresolver: fix hang on g_thread_pool_push() failure
    
    In resolve_sync function in gthreadedresolver.c, if g_thread_pool_push
    fails due to thread creation failure, we are just simply appending the
    data to the queue of work to do. After the failure, we might wait
    indefinitely in g_cond_wait. In case of g_thread_pool_push failure,
    propagate the error so that this function does not blocks forever in
    case of failure.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=651034

 gio/gthreadedresolver.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
index 8c98f47..4069048 100644
--- a/gio/gthreadedresolver.c
+++ b/gio/gthreadedresolver.c
@@ -326,8 +326,9 @@ resolve_sync (GThreadedResolver         *gtr,
     }
 
   req->cond = g_cond_new ();
-  g_thread_pool_push (gtr->thread_pool, req, NULL);
-  g_cond_wait (req->cond, req->mutex);
+  g_thread_pool_push (gtr->thread_pool, req, &req->error);
+  if (!req->error)
+    g_cond_wait (req->cond, req->mutex);
   g_mutex_unlock (req->mutex);
 
   if (req->error)



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