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 8efe505905
commit 628eee1c7d

View File

@@ -1144,7 +1144,7 @@ write_message_finish (GAsyncResult *res,
} }
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
static void maybe_write_next_message (GDBusWorker *worker); static void continue_writing (GDBusWorker *worker);
typedef struct typedef struct
{ {
@@ -1216,7 +1216,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);
@@ -1294,7 +1294,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);
} }
} }
@@ -1409,7 +1409,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;
@@ -1509,7 +1509,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;
@@ -1517,7 +1517,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;
} }
@@ -1551,7 +1551,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);