mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
shared/tests: add nmtst_main_context_assert_no_dispatch() helper
This commit is contained in:
parent
0008c6c801
commit
c4690eeeff
|
@ -1060,6 +1060,26 @@ _nmtst_main_context_iterate_until_timeout (gpointer user_data)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static inline void
|
||||
nmtst_main_context_assert_no_dispatch (GMainContext *context,
|
||||
guint timeout_msec)
|
||||
{
|
||||
nm_auto_destroy_and_unref_gsource GSource *source = NULL;
|
||||
gboolean timeout_hit = FALSE;
|
||||
|
||||
source = g_timeout_source_new (timeout_msec);
|
||||
g_source_set_callback (source, nmtst_g_source_set_boolean_true, &timeout_hit, NULL);
|
||||
g_source_attach (source, context);
|
||||
|
||||
while (g_main_context_iteration (context, TRUE)) {
|
||||
if (timeout_hit)
|
||||
return;
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
GMainLoop *_main_loop;
|
||||
union {
|
||||
|
|
Loading…
Reference in a new issue