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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Jan  9 14:25:39 2014 +0100

cobalt/posix/thread: call extension handler prior to changing schedparams

The Cobalt extension handler may want to access the thread scheduling
information before it is eventually updated by
pthread_setschedparam_ex().

Make sure this handler is called before xnthread_set_schedparam().

---

 kernel/cobalt/posix/thread.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 656ea30..f8b0e3b 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -433,22 +433,23 @@ pthread_setschedparam_ex(struct cobalt_thread *thread,
        if (!cobalt_obj_active(thread, COBALT_THREAD_MAGIC,
                               struct cobalt_thread)) {
                ret = -ESRCH;
-               goto fail;
+               goto out;
        }
 
        tslice = xnthread_time_slice(&thread->threadbase);
        sched_class = get_policy_param(&param, policy, param_ex, &tslice);
        if (sched_class == NULL) {
                ret = -EINVAL;
-               goto fail;
+               goto out;
        }
        thread->sched_u_policy = policy;
        xnthread_set_slice(&thread->threadbase, tslice);
+       if (cobalt_call_extension(thread_setsched, &thread->extref, ret,
+                                 sched_class, &param) && ret)
+               goto out;
        xnthread_set_schedparam(&thread->threadbase, sched_class, &param);
-       cobalt_call_extension(thread_setsched, &thread->extref, ret,
-                             sched_class, &param);
        xnsched_run();
-fail:
+out:
        xnlock_put_irqrestore(&nklock, s);
 
        return ret;


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

Reply via email to