Module: xenomai-forge Branch: next Commit: 5951586bbdbc01bff4103ec820827e44ccdb0e56 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=5951586bbdbc01bff4103ec820827e44ccdb0e56
Author: Philippe Gerum <r...@xenomai.org> Date: Wed May 21 17:23:10 2014 +0200 copperplate: introduce threadobj_set_schedprio() This is a service for solely updating the static priority of a thread while keeping its current scheduling class unchanged. --- include/copperplate/threadobj.h | 2 ++ lib/copperplate/threadobj.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/copperplate/threadobj.h b/include/copperplate/threadobj.h index 58a4f3e..44d1047 100644 --- a/include/copperplate/threadobj.h +++ b/include/copperplate/threadobj.h @@ -326,6 +326,8 @@ int threadobj_unlock_sched(void); int threadobj_set_schedparam(struct threadobj *thobj, int policy, const struct sched_param_ex *param_ex); +int threadobj_set_schedprio(struct threadobj *thobj, int priority); + int threadobj_set_mode(int clrmask, int setmask, int *mode_r); int threadobj_set_periodic(struct threadobj *thobj, diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c index 49f73f8..ab1334e 100644 --- a/lib/copperplate/threadobj.c +++ b/lib/copperplate/threadobj.c @@ -1514,6 +1514,23 @@ int threadobj_set_schedparam(struct threadobj *thobj, int policy, return __bt(ret); } +int threadobj_set_schedprio(struct threadobj *thobj, int priority) +{ /* thobj->lock held */ + struct sched_param_ex param_ex; + int policy; + + __threadobj_check_locked(thobj); + + param_ex = thobj->schedparam; + param_ex.sched_priority = priority; + policy = thobj->policy; + + if (policy == SCHED_RR) + param_ex.sched_rr_quantum = thobj->tslice; + + return __bt(threadobj_set_schedparam(thobj, policy, ¶m_ex)); +} + static inline int main_overlay(void) { struct threadobj_init_data idata; _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git