diff --git a/src/include/timer.h b/src/include/timer.h index 6b7baaf9fd..65ce9b4b79 100644 --- a/src/include/timer.h +++ b/src/include/timer.h @@ -165,6 +165,15 @@ static inline int stopwatch_expired(struct stopwatch *sw) return !mono_time_before(&sw->current, &sw->expires); } +/* + * Tick and check the stopwatch as long as it has not expired. + */ +static inline void stopwatch_wait_until_expired(struct stopwatch *sw) +{ + while (!stopwatch_expired(sw)) + ; +} + /* * Return number of microseconds since starting the stopwatch. */