[glib] Bug 585189 – g_cancellable_reset() must be called in same thread ...



commit ced88fd0de4aedb537552561582875b427081eeb
Author: Benjamin Otte <otte gnome org>
Date:   Tue Jun 9 10:54:22 2009 +0200

    Bug 585189 â?? g_cancellable_reset() must be called in same thread ...
    
    ... as g_cancellable_cancel()
    Rework a g_critical() that would (rarely) trigger when _reset() was
    called in a thread different from _cancel() by making _reset() wait for
    the cancel function to be finished the same way
    g_cancellable_disconnect() uses.
---
 gio/gcancellable.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gio/gcancellable.c b/gio/gcancellable.c
index e54d6c8..19326b5 100644
--- a/gio/gcancellable.c
+++ b/gio/gcancellable.c
@@ -327,11 +327,11 @@ g_cancellable_reset (GCancellable *cancellable)
 
   G_LOCK(cancellable);
   
-  if (cancellable->cancelled_running)
+  while (cancellable->cancelled_running)
     {
-      g_critical ("Can't reset a cancellable during an active operation");
-      G_UNLOCK(cancellable);
-      return;
+      cancellable->cancelled_running_waiting = TRUE;
+      g_cond_wait (cancellable_cond,
+                   g_static_mutex_get_mutex (& G_LOCK_NAME (cancellable)));
     }
   
   if (cancellable->cancelled)



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