mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01: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);
|
||||
}
|
||||
|
||||
#define SLEEP_USEC (100 * 1000)
|
||||
|
||||
static gpointer
|
||||
serials_thread_func (GDBusConnection *c)
|
||||
{
|
||||
guint32 message_serial;
|
||||
guint i;
|
||||
|
||||
/* No calls on this thread yet */
|
||||
g_assert_cmpint (g_dbus_connection_get_last_serial(c), ==, 0);
|
||||
@ -1127,8 +1130,15 @@ serials_thread_func (GDBusConnection *c)
|
||||
message_serial = 0;
|
||||
send_bogus_message (c, &message_serial);
|
||||
|
||||
/* Give it some time to actually send the message out */
|
||||
g_usleep (250000);
|
||||
/* Give it some time to actually send the message out. 10 seconds
|
||||
* 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), ==, message_serial);
|
||||
|
Loading…
Reference in New Issue
Block a user