timer: change timer_delayTicks() to use generic events
authorarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 8 Mar 2011 11:32:20 +0000 (11:32 +0000)
committerarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 8 Mar 2011 11:32:20 +0000 (11:32 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4759 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/drv/timer.c
bertos/drv/timer.h

index e3043da49a7014f5294a138081d5825dc9cff8e6..91784f9a8c96a2a033cfe0a4846a6bc2cd361f12 100644 (file)
@@ -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 */
index a68ee5b21dd9703735582fdad4c701ea7f10ec69..06f19ed31ca73076091d3b9f3d6b6a46c1058f95 100644 (file)
@@ -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)
 {