On Thu, 2005-07-14 at 23:37 +0100, Alan Cox wrote: > In actual fact you also want to fix users of > > while(time_before(foo, jiffies)) { whack(mole); } > > to become > > init_timeout(&timeout); > timeout.expires = jiffies + n > add_timeout(&timeout); > while(!timeout_expired(&timeout)) {} > > Which is a trivial wrapper around timers as we have them now Or something like this: struct timeout_timer { unsigned long expires; }; static inline void timeout_set(struct timeout_timer *timer, unsigned int msecs) { timer->expires = jiffies + msecs_to_jiffies(msecs); } static inline int timeout_expired(struct timeout_timer *timer) { return (time_after(jiffies, timer->expires)); } It provides a nice API for relative timeouts without adding overhead. - Eric St-Laurent - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- References:
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Dmitry Torokhov <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Lee Revell <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Andrew Morton <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Chris Wedgwood <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: dean gaudet <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Chris Wedgwood <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: dean gaudet <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Lee Revell <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Linus Torvalds <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Arjan van de Ven <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Vojtech Pavlik <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Linus Torvalds <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- From: Alan Cox <[email protected]>
- Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- Prev by Date: Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- Next by Date: Re: pc_keyb: controller jammed (0xA7)
- Previous by thread: Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- Next by thread: Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
- Index(es):