Module: xenomai-2.6
Branch: fix-heap
Commit: 2d945861b3805fd809e2919b008be649dc042d1e
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=2d945861b3805fd809e2919b008be649dc042d1e

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Jan 29 11:25:26 2013 +0100

nucleus/sched-tp: add safe guard when late for next window

---

 ksrc/nucleus/sched-tp.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/ksrc/nucleus/sched-tp.c b/ksrc/nucleus/sched-tp.c
index 545bb4c..575ecbb 100644
--- a/ksrc/nucleus/sched-tp.c
+++ b/ksrc/nucleus/sched-tp.c
@@ -53,6 +53,20 @@ static void tp_schedule_next(struct xnsched_tp *tp)
                ret = xntimer_start(&tp->tf_timer, t, XN_INFINITE, XN_ABSOLUTE);
                if (ret != -ETIMEDOUT)
                        break;
+               /*
+                * We are late, make sure to remain within the bounds
+                * of a valid time frame before advancing to the next
+                * window. Otherwise, fix up by advancing to the next
+                * time frame immediately.
+                */
+               for (;;) {
+                       t = tp->tf_start + tp->gps->tf_duration;
+                       if (xnpod_get_cpu_time() > t) {
+                               tp->tf_start = t;
+                               tp->wnext = 0;
+                       } else
+                               break;
+               }
        }
 
        sched = container_of(tp, struct xnsched, tp);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to