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

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 b7b6a21..354dece 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