mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-18 03:31:57 +02:00
gdbus-connection: wait up to 10s to actually send a message
We previously waited 0.25s, which should be enough even on slow machines, but you never know; but we also now wait in 0.1s increments, so this test should actually be faster now. Bug: https://bugzilla.gnome.org/show_bug.cgi?id=724113 Acked-by: Matthias Clasen <mclasen@redhat.com>
This commit is contained in:
parent
f1c2e70345
commit
3beb67f9f3
@ -1115,10 +1115,13 @@ send_bogus_message (GDBusConnection *c, guint32 *out_serial)
|
|||||||
g_object_unref (m);
|
g_object_unref (m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SLEEP_USEC (100 * 1000)
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
serials_thread_func (GDBusConnection *c)
|
serials_thread_func (GDBusConnection *c)
|
||||||
{
|
{
|
||||||
guint32 message_serial;
|
guint32 message_serial;
|
||||||
|
guint i;
|
||||||
|
|
||||||
/* No calls on this thread yet */
|
/* No calls on this thread yet */
|
||||||
g_assert_cmpint (g_dbus_connection_get_last_serial(c), ==, 0);
|
g_assert_cmpint (g_dbus_connection_get_last_serial(c), ==, 0);
|
||||||
@ -1127,8 +1130,15 @@ serials_thread_func (GDBusConnection *c)
|
|||||||
message_serial = 0;
|
message_serial = 0;
|
||||||
send_bogus_message (c, &message_serial);
|
send_bogus_message (c, &message_serial);
|
||||||
|
|
||||||
/* Give it some time to actually send the message out */
|
/* Give it some time to actually send the message out. 10 seconds
|
||||||
g_usleep (250000);
|
* should be plenty, even on slow machines. */
|
||||||
|
for (i = 0; i < 10 * G_USEC_PER_SEC / SLEEP_USEC; i++)
|
||||||
|
{
|
||||||
|
if (g_dbus_connection_get_last_serial(c) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
g_usleep (SLEEP_USEC);
|
||||||
|
}
|
||||||
|
|
||||||
g_assert_cmpint (g_dbus_connection_get_last_serial(c), !=, 0);
|
g_assert_cmpint (g_dbus_connection_get_last_serial(c), !=, 0);
|
||||||
g_assert_cmpint (g_dbus_connection_get_last_serial(c), ==, message_serial);
|
g_assert_cmpint (g_dbus_connection_get_last_serial(c), ==, message_serial);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user