X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Ftimer.h;h=be7bce2f4b9085eedf64837d8c2fa9b35ffe81fe;hb=739e1050dcc320af88e7ab227a15d26eb63e5726;hp=d2bfd86b08c45b3ed7758c300b25788c0184fdd3;hpb=dd986e09fdbb79be4a7e8dbb77dca8f68c04c321;p=openvswitch diff --git a/lib/timer.h b/lib/timer.h index d2bfd86b..be7bce2f 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -20,13 +20,15 @@ #include #include "timeval.h" +#include "util.h" struct timer { long long int t; }; long long int timer_msecs_until_expired(const struct timer *); -void timer_wait(const struct timer *); +void timer_wait(const struct timer *, const char *where); +#define timer_wait(timer) timer_wait(timer, SOURCE_LOCATOR) /* Causes 'timer' to expire when 'duration' milliseconds have passed. * @@ -55,18 +57,11 @@ timer_set_expired(struct timer *timer) timer->t = LLONG_MIN; } -/* True if 'timer' had (or will have) expired at 'time'. */ -static inline bool -timer_expired_at(const struct timer *timer, long long int time) -{ - return time >= timer->t; -} - /* True if 'timer' has expired. */ static inline bool timer_expired(const struct timer *timer) { - return timer_expired_at(timer, time_msec()); + return time_msec() >= timer->t; } /* Returns ture if 'timer' will never expire. */