Messages in this thread | | | Date | Tue, 11 May 2004 22:38:13 +0200 | From | Ingo Molnar <> | Subject | Re: [RFC] [PATCH] Performance of del_timer_sync |
| |
* Chen, Kenneth W <kenneth.w.chen@intel.com> wrote:
> > +int del_single_shot_timer(struct timer_struct *timer) > > +{ > > + if (del_timer(timer)) > > + del_timer_sync(timer); > > +} > > #endif > > I'm confused, isn't the polarity of del_timer() need to be reversed? > Also propagate the return value of del_timer_sync()?
indeed. If the removal didnt succeed then we must make sure there's no timer fn pending. Btw., in that case del_timer_sync() must not succeed - it would mean the timer fn re-added the timer, which by definition must not happen here. So i'd go for:
int del_single_shot_timer(struct timer_struct *timer) { int ret = del_timer(timer);
if (!ret) { ret = del_timer_sync(timer); BUG_ON(ret); }
return ret; }
this should catch illegal uses of del_single_shot_timer().
Ingo - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |