From: arighi Date: Tue, 8 Mar 2011 11:32:20 +0000 (+0000) Subject: timer: change timer_delayTicks() to use generic events X-Git-Tag: 2.7.0~207 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=f0c6ef0573ea9487ce6852249828cfd39cdae6bf;p=bertos.git timer: change timer_delayTicks() to use generic events git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4759 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/drv/timer.c b/bertos/drv/timer.c index e3043da4..91784f9a 100644 --- a/bertos/drv/timer.c +++ b/bertos/drv/timer.c @@ -255,11 +255,10 @@ void timer_delayTicks(ticks_t delay) DB(t.magic = TIMER_MAGIC_INACTIVE;) if (proc_preemptAllowed()) { - ASSERT(!sig_check(SIG_SINGLE)); - timer_setSignal(&t, proc_current(), SIG_SINGLE); + timer_setEvent(&t); timer_setDelay(&t, delay); timer_add(&t); - sig_wait(SIG_SINGLE); + timer_waitEvent(&t); } else #endif /* !CONFIG_KERN_SIGNALS */ diff --git a/bertos/drv/timer.h b/bertos/drv/timer.h index a68ee5b2..06f19ed3 100644 --- a/bertos/drv/timer.h +++ b/bertos/drv/timer.h @@ -310,6 +310,18 @@ void synctimer_poll(List* q); #if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS +/** Set the timer so that it sends a event notification when it expires */ +INLINE void timer_setEvent(Timer *timer) +{ + event_initGeneric(&timer->expire); +} + +/** Wait until the timer expires */ +INLINE void timer_waitEvent(Timer *timer) +{ + event_wait(&timer->expire); +} + /** Set the timer so that it sends a signal when it expires */ INLINE void timer_setSignal(Timer *timer, struct Process *proc, sigmask_t sigs) {