diff options
author | Jens Gustedt <Jens.Gustedt@inria.fr> | 2014-09-01 00:46:23 +0200 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-09-06 18:11:24 -0400 |
commit | df7d0dfb9c686df31149d09008ba92834bed9803 (patch) | |
tree | 758743956de08b94514757bda68a628751d0f533 /src/thread/pthread_cond_timedwait.c | |
parent | 6eb19505bc10eb7964c4863e53ef1028944044f2 (diff) | |
download | musl-df7d0dfb9c686df31149d09008ba92834bed9803.tar.gz |
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.
Diffstat (limited to 'src/thread/pthread_cond_timedwait.c')
-rw-r--r-- | src/thread/pthread_cond_timedwait.c | 12 |
1 files changed, 9 insertions, 3 deletions
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); |