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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon May 19 16:36:20 2014 +0200

psos/task: detect failure to enter round-robin at startup

---

 lib/psos/task.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/psos/task.c b/lib/psos/task.c
index ddfe54e..18d8c0b 100644
--- a/lib/psos/task.c
+++ b/lib/psos/task.c
@@ -183,6 +183,7 @@ static void *task_trampoline(void *arg)
        struct psos_task *task = arg;
        struct psos_task_args *args = &task->args;
        struct service svc;
+       int ret;
 
        CANCEL_DEFER(svc);
 
@@ -190,8 +191,19 @@ static void *task_trampoline(void *arg)
 
        threadobj_lock(&task->thobj);
 
-       if (task->mode & T_TSLICE)
-               threadobj_set_rr(&task->thobj, &psos_rrperiod);
+       if (task->mode & T_TSLICE) {
+               ret = threadobj_set_rr(&task->thobj, &psos_rrperiod);
+               if (ret) {
+                       warning("task %s failed to enter round-robin 
scheduling, %s",
+                               threadobj_get_name(&task->thobj),
+                               symerror(ret));
+                       threadobj_set_magic(&task->thobj, ~task_magic);
+                       threadobj_unlock(&task->thobj);
+                       CANCEL_RESTORE(svc);
+                       threadobj_notify_entry();
+                       return (void *)(long)ret;
+               }
+       }
 
        if (task->mode & T_NOPREEMPT)
                __threadobj_lock_sched(&task->thobj);


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

Reply via email to