GDBusWorker: rename some functions

maybe_write_next_message now also closes, and I'm about to make it
consider whether to flush as well, so its name is increasingly
inappropriate. Similarly, write_message_in_idle_cb is a wrapper around
it which could do any of those things.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
This commit is contained in:
Simon McVittie 2011-10-21 14:43:44 +01:00
parent 18482ab17e
commit 56eb16ff50

View File

@ -1141,7 +1141,7 @@ write_message_finish (GAsyncResult *res,
} }
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
static void maybe_write_next_message (GDBusWorker *worker); static void continue_writing (GDBusWorker *worker);
typedef struct typedef struct
{ {
@ -1213,7 +1213,7 @@ ostream_flush_cb (GObject *source_object,
g_mutex_unlock (&data->worker->write_lock); g_mutex_unlock (&data->worker->write_lock);
/* OK, cool, finally kick off the next write */ /* OK, cool, finally kick off the next write */
maybe_write_next_message (data->worker); continue_writing (data->worker);
_g_dbus_worker_unref (data->worker); _g_dbus_worker_unref (data->worker);
g_free (data); g_free (data);
@ -1291,7 +1291,7 @@ message_written (GDBusWorker *worker,
else else
{ {
/* kick off the next write! */ /* kick off the next write! */
maybe_write_next_message (worker); continue_writing (worker);
} }
} }
@ -1406,7 +1406,7 @@ iostream_close_cb (GObject *source_object,
* output_pending must be PENDING_NONE on entry * output_pending must be PENDING_NONE on entry
*/ */
static void static void
maybe_write_next_message (GDBusWorker *worker) continue_writing (GDBusWorker *worker)
{ {
MessageToWriteData *data; MessageToWriteData *data;
@ -1506,7 +1506,7 @@ maybe_write_next_message (GDBusWorker *worker)
* output_pending may be anything * output_pending may be anything
*/ */
static gboolean static gboolean
write_message_in_idle_cb (gpointer user_data) continue_writing_in_idle_cb (gpointer user_data)
{ {
GDBusWorker *worker = user_data; GDBusWorker *worker = user_data;
@ -1514,7 +1514,7 @@ write_message_in_idle_cb (gpointer user_data)
* without holding the lock: no other thread ever modifies it. * without holding the lock: no other thread ever modifies it.
*/ */
if (worker->output_pending == PENDING_NONE) if (worker->output_pending == PENDING_NONE)
maybe_write_next_message (worker); continue_writing (worker);
return FALSE; return FALSE;
} }
@ -1548,7 +1548,7 @@ schedule_write_in_worker_thread (GDBusWorker *worker,
idle_source = g_idle_source_new (); idle_source = g_idle_source_new ();
g_source_set_priority (idle_source, G_PRIORITY_DEFAULT); g_source_set_priority (idle_source, G_PRIORITY_DEFAULT);
g_source_set_callback (idle_source, g_source_set_callback (idle_source,
write_message_in_idle_cb, continue_writing_in_idle_cb,
_g_dbus_worker_ref (worker), _g_dbus_worker_ref (worker),
(GDestroyNotify) _g_dbus_worker_unref); (GDestroyNotify) _g_dbus_worker_unref);
g_source_attach (idle_source, worker->shared_thread_data->context); g_source_attach (idle_source, worker->shared_thread_data->context);