Module: xenomai-jki
Branch: for-upstream
Commit: a9b06c6aab1d599a08c0a41b3963d062b7836f25
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=a9b06c6aab1d599a08c0a41b3963d062b7836f25

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Mon Nov 18 19:08:11 2013 +0100

switchtest: Bail out early from rtswitch_ktask on termination

rtswitch_pend_rt may have been interrupted if the task is supposed to
stop. Reorder the test for this in order to avoid starting to run on
invalid data.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 kernel/drivers/testing/switchtest.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/drivers/testing/switchtest.c 
b/kernel/drivers/testing/switchtest.c
index 6f77ee9..8850962 100644
--- a/kernel/drivers/testing/switchtest.c
+++ b/kernel/drivers/testing/switchtest.c
@@ -400,7 +400,7 @@ static void rtswitch_ktask(void *cookie)
 
        rtswitch_pend_rt(ctx, task->base.index);
 
-       for(;;) {
+       while (!rtdm_task_should_stop()) {
                if (task->base.flags & RTTST_SWTEST_USE_FPU)
                        fp_regs_set(fp_features, task->base.index + i * 1000);
 
@@ -433,9 +433,6 @@ static void rtswitch_ktask(void *cookie)
                        }
                }
 
-               if (rtdm_task_should_stop())
-                       break;
-
                if (++i == 4000000)
                        i = 0;
        }


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

Reply via email to