summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-07 20:12:32 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-07 20:12:32 +0100
commitaa57d4aa1c975ed057b3fefc38576c0e3214f716 (patch)
tree9cde099e58f4abd313c7b4b6816f95a426931097
parente785d7e039991225e8bd025df1a87e8563de93b1 (diff)
self-handle test: use an idle to signal GetAll messagesgdbus-properties
got_all_counter_filter() runs in a separate thread, so it isn't sufficient to write to a variable and hope that the main thread will see it. Unfortunately, this change doesn't seem to be sufficient either: under load (running the Gabble tests in parallel with this test is enough), the test still times out waiting for the variable to be incremented...
-rw-r--r--tests/dbus/self-handle.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/dbus/self-handle.c b/tests/dbus/self-handle.c
index 464cd7423..17d21a94b 100644
--- a/tests/dbus/self-handle.c
+++ b/tests/dbus/self-handle.c
@@ -97,6 +97,15 @@ swapped_counter_cb (gpointer user_data)
++*times;
}
+static gboolean
+inc_in_main_thread_cb (gpointer user_data)
+{
+ guint *times = user_data;
+
+ ++*times;
+ return G_SOURCE_REMOVE;
+}
+
static GDBusMessage *
got_all_counter_filter (GDBusConnection *connection,
GDBusMessage *message,
@@ -107,7 +116,7 @@ got_all_counter_filter (GDBusConnection *connection,
if (incoming &&
!tp_strdiff (g_dbus_message_get_member (message), "GetAll"))
- ++*times;
+ g_idle_add_full (G_PRIORITY_HIGH, inc_in_main_thread_cb, times, NULL);
return message;
}