[patch 1/4] Timerfd v3 - introduce a new hrtimer_forward_now() function

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Michael Kerrisk <mtk-manpages@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, Linus Torvalds <torvalds@...>
Date: Sunday, November 25, 2007 - 6:14 pm

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 <davidel@xmailserver.org>


- Davide


---
 include/linux/hrtimer.h |    7 +++++++
 1 file changed, 7 insertions(+)

Index: linux-2.6.mod/include/linux/hrtimer.h
===================================================================
--- linux-2.6.mod.orig/include/linux/hrtimer.h	2007-11-23 13:55:16.000000000 -0800
+++ linux-2.6.mod/include/linux/hrtimer.h	2007-11-24 12:48:05.000000000 -0800
@@ -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 *rmtp,

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 1/4] Timerfd v3 - introduce a new hrtimer_forward_now..., Davide Libenzi, (Sun Nov 25, 6:14 pm)