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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu May 31 19:43:22 2012 +0200

psos: allow for disabling preemption before toggling RR

---

 lib/psos/task.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/psos/task.c b/lib/psos/task.c
index 0ebe4b1..a5b056a 100644
--- a/lib/psos/task.c
+++ b/lib/psos/task.c
@@ -543,15 +543,20 @@ u_long t_mode(u_long mask, u_long newmask, u_long 
*oldmode_r)
        task->mode &= ~mask;
        task->mode |= (newmask & mask);
 
-       if (task->mode & T_TSLICE)
-               threadobj_set_rr(&task->thobj, &psos_rrperiod);
-       else
-               threadobj_set_rr(&task->thobj, NULL);
-
        if (task->mode & T_NOPREEMPT)
                threadobj_lock_sched_once(&task->thobj);
        else if (*oldmode_r & T_NOPREEMPT)
                threadobj_unlock_sched(&task->thobj);
+
+       /*
+        * Copperplate won't accept to turn round-robin on/off when
+        * preemption is disabled, so we leave user a chance to do the
+        * right thing first.
+        */
+       if (task->mode & T_TSLICE)
+               threadobj_set_rr(&task->thobj, &psos_rrperiod);
+       else if (*oldmode_r & T_TSLICE)
+               threadobj_set_rr(&task->thobj, NULL);
 done:
        put_psos_task(task);
 


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

Reply via email to