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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Jun 24 16:29:16 2013 +0200

include/cobalt: fix build over uClibc

Cobalt does implement pthread_mutexattr_set/getprotocol(), as well as
pthread_condattr_set/getclock(), so these may be declared
unconditionally in a Cobalt-specific header file.

In addition, we detect when pthread_yield() is a macro such as in the
uClibc case, so prevent preprocessing errors with
COBALT_DECL(). uClibc wraps pthread_yield() to sched_yield(), which we
override too, so that's fine with us.

---

 include/cobalt/pthread.h |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h
index a21f279..a7743d9 100644
--- a/include/cobalt/pthread.h
+++ b/include/cobalt/pthread.h
@@ -247,7 +247,10 @@ COBALT_DECL(int, pthread_getschedparam(pthread_t thread,
 COBALT_DECL(int, pthread_setschedparam(pthread_t thread,
                                       int policy,
                                       const struct sched_param *param));
+
+#ifndef pthread_yield  /* likely uClibc wrapping otherwise. */
 COBALT_DECL(int, pthread_yield(void));
+#endif
 
 COBALT_DECL(int, pthread_mutexattr_init(pthread_mutexattr_t *attr));
 
@@ -259,14 +262,6 @@ COBALT_DECL(int, pthread_mutexattr_gettype(const 
pthread_mutexattr_t *attr,
 COBALT_DECL(int, pthread_mutexattr_settype(pthread_mutexattr_t *attr,
                                           int type));
 
-#ifdef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
-COBALT_DECL(int, pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
-                                              int *proto));
-
-COBALT_DECL(int, pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
-                                              int proto));
-#endif
-
 COBALT_DECL(int, pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr,
                                              int *pshared));
 
@@ -321,21 +316,17 @@ COBALT_DECL(int, pthread_cond_broadcast(pthread_cond_t 
*cond));
 
 COBALT_DECL(int, pthread_kill(pthread_t tid, int sig));
 
-#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 COBALT_DECL(int, pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
                                               int *proto));
 
 COBALT_DECL(int, pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
                                               int proto));
-#endif
 
-#ifndef HAVE_PTHREAD_CONDATTR_SETCLOCK
 COBALT_DECL(int, pthread_condattr_getclock(const pthread_condattr_t *attr,
                                           clockid_t *clk_id));
 
 COBALT_DECL(int, pthread_condattr_setclock(pthread_condattr_t *attr,
                                           clockid_t clk_id));
-#endif
 
 int pthread_make_periodic_np(pthread_t thread,
                             clockid_t clk_id,


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

Reply via email to