Module: xenomai-3
Branch: next
Commit: 1a81c5de3fb7be74bb047a812d94550b278416d4
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1a81c5de3fb7be74bb047a812d94550b278416d4

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 b90fa70..b1000c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -543,6 +543,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 1b26c84..75e2d1d 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -169,6 +169,25 @@ int pthread_setaffinity_np(pthread_t thread, size_t 
cpusetsize,
 }
 #endif /* !HAVE_PTHREAD_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, &param);
+       if (ret)
+               return ret;
+
+       param.sched_priority = prio;
+
+       return pthread_setschedparam(thread, policy, &param);
+}
+
+#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

Reply via email to