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.
This commit is contained in:
Benjamin Otte 2009-06-09 10:54:22 +02:00
parent 7d4b706305
commit ced88fd0de

View File

@ -327,11 +327,11 @@ g_cancellable_reset (GCancellable *cancellable)
G_LOCK(cancellable); G_LOCK(cancellable);
if (cancellable->cancelled_running) while (cancellable->cancelled_running)
{ {
g_critical ("Can't reset a cancellable during an active operation"); cancellable->cancelled_running_waiting = TRUE;
G_UNLOCK(cancellable); g_cond_wait (cancellable_cond,
return; g_static_mutex_get_mutex (& G_LOCK_NAME (cancellable)));
} }
if (cancellable->cancelled) if (cancellable->cancelled)