Module: xenomai-3 Branch: next Commit: 2cf7b10e57f7c7888fce5defcb9c46661e1d6cd0 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2cf7b10e57f7c7888fce5defcb9c46661e1d6cd0
Author: Philippe Gerum <r...@xenomai.org> Date: Tue May 24 09:43:29 2016 +0200 boilerplate/libc: add placeholder for pthread_setschedprio() For outdated uClibc. --- configure.ac | 1 + include/boilerplate/libc.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac index 5bcd7f8..1397659 100644 --- a/configure.ac +++ b/configure.ac @@ -540,6 +540,7 @@ AC_CHECK_FUNCS([pthread_mutexattr_setprotocol \ pthread_getattr_np \ pthread_atfork \ pthread_setname_np \ + pthread_setschedprio \ sched_getcpu \ clock_nanosleep \ shm_open \ diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h index 6616cef..3c9c970 100644 --- a/include/boilerplate/libc.h +++ b/include/boilerplate/libc.h @@ -168,6 +168,25 @@ int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize, #endif /* !HAVE_PTHREAD_ATTR_SETAFFINITY_NP */ +#ifndef HAVE_PTHREAD_SETSCHEDPRIO + +static inline +int pthread_setschedprio(pthread_t thread, int prio) +{ + struct sched_param param; + int policy, ret; + + ret = pthread_getschedparam(thread, &policy, ¶m); + if (ret) + return ret; + + param.sched_priority = prio; + + return pthread_setschedparam(thread, policy, ¶m); +} + +#endif /* !HAVE_PTHREAD_SETSCHEDPRIO */ + #if !defined(HAVE_CLOCK_NANOSLEEP) && defined(CONFIG_XENO_MERCURY) /* * Best effort for a Mercury setup based on an outdated libc lacking _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git