[glib/glib-2-26] Bug 635626 – GDBus message idle can execute while flushes are pending
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-26] Bug 635626 – GDBus message idle can execute while flushes are pending
- Date: Mon, 13 Dec 2010 18:34:41 +0000 (UTC)
commit b2315084cb21a1ef072a48b0238a2e614af78be3
Author: Ted Gould <ted gould cx>
Date: Mon Dec 13 13:33:15 2010 -0500
Bug 635626 â?? GDBus message idle can execute while flushes are pending
https://bugzilla.gnome.org/show_bug.cgi?id=635626
Signed-off-by: David Zeuthen <davidz redhat com>
gio/gdbusprivate.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index dd9d58a..228c28c 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -431,6 +431,7 @@ struct GDBusWorker
gint num_writes_pending;
guint64 write_num_messages_written;
GList *write_pending_flushes;
+ gboolean flush_pending;
};
/* ---------------------------------------------------------------------------------------------------- */
@@ -1158,6 +1159,12 @@ ostream_flush_cb (GObject *source_object,
if (error != NULL)
g_error_free (error);
+ /* Make sure we tell folks that we don't have additional
+ flushes pending */
+ g_mutex_lock (data->worker->write_lock);
+ data->worker->flush_pending = FALSE;
+ g_mutex_unlock (data->worker->write_lock);
+
/* OK, cool, finally kick off the next write */
maybe_write_next_message (data->worker);
@@ -1210,6 +1217,10 @@ message_written (GDBusWorker *worker,
worker->write_pending_flushes = g_list_delete_link (worker->write_pending_flushes, l);
}
}
+ if (flushers != NULL)
+ {
+ worker->flush_pending = TRUE;
+ }
g_mutex_unlock (worker->write_lock);
if (flushers != NULL)
@@ -1344,7 +1355,7 @@ static gboolean
write_message_in_idle_cb (gpointer user_data)
{
GDBusWorker *worker = user_data;
- if (worker->num_writes_pending == 0)
+ if (worker->num_writes_pending == 0 && !worker->flush_pending)
maybe_write_next_message (worker);
return FALSE;
}
@@ -1427,6 +1438,7 @@ _g_dbus_worker_new (GIOStream *stream,
worker->stream = g_object_ref (stream);
worker->capabilities = capabilities;
worker->cancellable = g_cancellable_new ();
+ worker->flush_pending = FALSE;
worker->frozen = initially_frozen;
worker->received_messages_while_frozen = g_queue_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]