new timerfd API v2 - introduce a new hrtimer_forward_now() function
PATCH 1/4 new timerfd API v2 - introduce a new hrtimer_forward_now() function
I think that advancing the timer against the timer's current "now" can be a pretty common usage, so, w/out exposing hrtimer's internals, we add a new hrtimer_forward_now() function.
Signed-off-by Davide Libenzi <[email protected]>
- Davide
--- include/linux/hrtimer.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/linux/hrtimer.h +7 -0
@@ -298,6 +298,13 @@extern unsigned long hrtimer_forward (struct hrtimer *timer,ktime_t now,ktime_t interval); +/* Forward a hrtimer so it expires after the hrtimer's current now */ +static inline unsigned long hrtimer_forward_now (struct hrtimer *timer, +ktime_t interval) +{ +return hrtimer_forward (timer, timer->base->get_time (), interval); +} +/* Precise sleep: */ extern long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
Quoted 7 lines · Davide Libenzi
I think that advancing the timer against the timer's current "now" can be a pretty common usage, so, w/out exposing hrtimer's internals, we add a new
hrtimer_forward_now()function.Signed-off-by Davide Libenzi <[email protected]>
Reviewed-and-Acked-by Thomas Gleixner <[email protected]>
Quoted 27 lines
- Davide
--- include/linux/hrtimer.h | 7 +++++++ 1 file changed, 7 insertions(+)Index:
linux-2.6.mod/include/linux/hrtimer.h
===================================================================include/linux/hrtimer.h +7
-0@@ -298,6 +298,13 @@extern unsigned long hrtimer_forward (struct hrtimer *timer,ktime_t now,ktime_t interval); +/* Forward a hrtimer so it expires after the hrtimer's current now */ +static inline unsigned long hrtimer_forward_now (struct hrtimer *timer, +ktime_t interval) +{ +return hrtimer_forward (timer, timer->base->get_time (), interval); +} +/* Precise sleep: */ extern long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,