From df7d0dfb9c686df31149d09008ba92834bed9803 Mon Sep 17 00:00:00 2001 From: Jens Gustedt Date: Mon, 1 Sep 2014 00:46:23 +0200 Subject: use weak symbols for the POSIX functions that will be used by C threads The intent of this is to avoid name space pollution of the C threads implementation. This has two sides to it. First we have to provide symbols that wouldn't pollute the name space for the C threads implementation. Second we have to clean up some internal uses of POSIX functions such that they don't implicitly drag in such symbols. --- src/thread/pthread_cond_timedwait.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/thread/pthread_cond_timedwait.c') diff --git a/src/thread/pthread_cond_timedwait.c b/src/thread/pthread_cond_timedwait.c index 2d192b07..0a80d305 100644 --- a/src/thread/pthread_cond_timedwait.c +++ b/src/thread/pthread_cond_timedwait.c @@ -1,5 +1,9 @@ #include "pthread_impl.h" +void __pthread_testcancel(void); +int __pthread_mutex_lock(pthread_mutex_t *); +int __pthread_mutex_unlock(pthread_mutex_t *); + /* * struct waiter * @@ -119,7 +123,7 @@ static void unwait(void *arg) } } -int pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restrict m, const struct timespec *restrict ts) +int __pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restrict m, const struct timespec *restrict ts) { struct waiter node = { .cond = c, .mutex = m }; int e, seq, *fut, clock = c->_c_clock; @@ -130,7 +134,7 @@ int pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restrict if (ts && ts->tv_nsec >= 1000000000UL) return EINVAL; - pthread_testcancel(); + __pthread_testcancel(); if (c->_c_shared) { node.shared = 1; @@ -151,7 +155,7 @@ int pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restrict unlock(&c->_c_lock); } - pthread_mutex_unlock(m); + __pthread_mutex_unlock(m); do e = __timedwait(fut, seq, clock, ts, unwait, &node, !node.shared); while (*fut==seq && (!e || e==EINTR)); @@ -197,3 +201,5 @@ int __private_cond_signal(pthread_cond_t *c, int n) return 0; } + +weak_alias(__pthread_cond_timedwait, pthread_cond_timedwait); -- cgit 1.4.1