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

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 6ff8afb..5b9f518 100644
--- a/configure.ac
+++ b/configure.ac
@@ -546,6 +546,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, &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