Module: xenomai-2.4
Branch: master
Commit: 4705f4f33e268b056b8dc5d350dc314ab21cea4e
URL:    
http://git.xenomai.org/?p=xenomai-2.4.git;a=commit;h=4705f4f33e268b056b8dc5d350dc314ab21cea4e

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Aug 20 07:40:20 2010 +0200

nucleus: requeue blocked non-periodic timers properly

---

 ksrc/nucleus/timer.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ksrc/nucleus/timer.c b/ksrc/nucleus/timer.c
index 5fe8d08..bfb7306 100644
--- a/ksrc/nucleus/timer.c
+++ b/ksrc/nucleus/timer.c
@@ -283,9 +283,9 @@ void xntimer_tick_aperiodic(void)
 {
        xnsched_t *sched = xnpod_current_sched();
        xntimerq_t *timerq = &sched->timerqueue;
+       xnticks_t now, interval;
        xntimerh_t *holder;
        xntimer_t *timer;
-       xnticks_t now;
 
        /* Optimisation: any local timer reprogramming triggered by invoked
           timer handlers can wait until we leave the tick handler. Use this
@@ -324,8 +324,8 @@ void xntimer_tick_aperiodic(void)
                                /* Postpone the next tick to a reasonable date 
in
                                   the future, waiting for the timebase to be 
unlocked
                                   at some point. */
-                               xntimerh_date(&timer->aplink) = 
xntimerh_date(&sched->htimer.aplink);
-                               continue;
+                               interval = xnarch_ns_to_tsc(250000000ULL);
+                               goto requeue;
                        }
                } else {
                        /* By postponing the propagation of the low-priority 
host
@@ -337,8 +337,10 @@ void xntimer_tick_aperiodic(void)
                                continue;
                }
 
+               interval = timer->interval;
+       requeue:
                do {
-                       xntimerh_date(&timer->aplink) += timer->interval;
+                       xntimerh_date(&timer->aplink) += interval;
                } while (xntimerh_date(&timer->aplink) < now + nklatency);
                xntimer_enqueue_aperiodic(timer);
        }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to