mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-26 05:30:46 +02:00
test: add NMTST_BUSY_WAIT() util
This commit is contained in:
parent
eebfe56a90
commit
4eb48d8c87
1 changed files with 12 additions and 0 deletions
|
|
@ -125,6 +125,18 @@ nmtst_assert_error (GError *error,
|
|||
}
|
||||
}
|
||||
|
||||
#define NMTST_BUSY_WAIT(max_wait_ms, condition, wait) \
|
||||
G_STMT_START { \
|
||||
gint64 _nmtst_end, _nmtst_max_wait_us = (max_wait_ms) * 1000L; \
|
||||
\
|
||||
_nmtst_end = g_get_monotonic_time () + _nmtst_max_wait_us; \
|
||||
while (!(condition)) { \
|
||||
{ wait }; \
|
||||
if (g_get_monotonic_time () > _nmtst_end) \
|
||||
g_assert_not_reached (); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
/*******************************************************************************/
|
||||
|
||||
struct __nmtst_internal
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue