hidden int __pthread_cond_timedwait(pthread_cond_t *restrict, pthread_mutex_t *restrict, const struct timespec *restrict);
hidden int __pthread_key_create(pthread_key_t *, void (*)(void *));
hidden int __pthread_key_delete(pthread_key_t);
+hidden int __pthread_rwlock_rdlock(pthread_rwlock_t *);
+hidden int __pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+hidden int __pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+hidden int __pthread_rwlock_wrlock(pthread_rwlock_t *);
+hidden int __pthread_rwlock_trywrlock(pthread_rwlock_t *);
+hidden int __pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+hidden int __pthread_rwlock_unlock(pthread_rwlock_t *);
#endif
/* Purely a sentinel value since null means slot is free. */
if (!dtor) dtor = nodtor;
- pthread_rwlock_wrlock(&key_lock);
+ __pthread_rwlock_wrlock(&key_lock);
do {
if (!keys[j]) {
keys[next_key = *k = j] = dtor;
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
return 0;
}
} while ((j=(j+1)%PTHREAD_KEYS_MAX) != next_key);
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
return EAGAIN;
}
__tl_unlock();
__restore_sigs(&set);
- pthread_rwlock_wrlock(&key_lock);
+ __pthread_rwlock_wrlock(&key_lock);
keys[k] = 0;
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
return 0;
}
pthread_t self = __pthread_self();
int i, j;
for (j=0; self->tsd_used && j<PTHREAD_DESTRUCTOR_ITERATIONS; j++) {
- pthread_rwlock_rdlock(&key_lock);
+ __pthread_rwlock_rdlock(&key_lock);
self->tsd_used = 0;
for (i=0; i<PTHREAD_KEYS_MAX; i++) {
void *val = self->tsd[i];
void (*dtor)(void *) = keys[i];
self->tsd[i] = 0;
if (val && dtor && dtor != nodtor) {
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
dtor(val);
- pthread_rwlock_rdlock(&key_lock);
+ __pthread_rwlock_rdlock(&key_lock);
}
}
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
}
}
#include "pthread_impl.h"
-int pthread_rwlock_rdlock(pthread_rwlock_t *rw)
+int __pthread_rwlock_rdlock(pthread_rwlock_t *rw)
{
- return pthread_rwlock_timedrdlock(rw, 0);
+ return __pthread_rwlock_timedrdlock(rw, 0);
}
+
+weak_alias(__pthread_rwlock_rdlock, pthread_rwlock_rdlock);
#include "pthread_impl.h"
-int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict rw, const struct timespec *restrict at)
+int __pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict rw, const struct timespec *restrict at)
{
int r, t;
int spins = 100;
while (spins-- && rw->_rw_lock && !rw->_rw_waiters) a_spin();
- while ((r=pthread_rwlock_tryrdlock(rw))==EBUSY) {
+ while ((r=__pthread_rwlock_tryrdlock(rw))==EBUSY) {
if (!(r=rw->_rw_lock) || (r&0x7fffffff)!=0x7fffffff) continue;
t = r | 0x80000000;
a_inc(&rw->_rw_waiters);
}
return r;
}
+
+weak_alias(__pthread_rwlock_timedrdlock, pthread_rwlock_timedrdlock);
#include "pthread_impl.h"
-int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rw, const struct timespec *restrict at)
+int __pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rw, const struct timespec *restrict at)
{
int r, t;
int spins = 100;
while (spins-- && rw->_rw_lock && !rw->_rw_waiters) a_spin();
- while ((r=pthread_rwlock_trywrlock(rw))==EBUSY) {
+ while ((r=__pthread_rwlock_trywrlock(rw))==EBUSY) {
if (!(r=rw->_rw_lock)) continue;
t = r | 0x80000000;
a_inc(&rw->_rw_waiters);
}
return r;
}
+
+weak_alias(__pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock);
#include "pthread_impl.h"
-int pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
+int __pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
{
int val, cnt;
do {
} while (a_cas(&rw->_rw_lock, val, val+1) != val);
return 0;
}
+
+weak_alias(__pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock);
#include "pthread_impl.h"
-int pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
+int __pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
{
if (a_cas(&rw->_rw_lock, 0, 0x7fffffff)) return EBUSY;
return 0;
}
+
+weak_alias(__pthread_rwlock_trywrlock, pthread_rwlock_trywrlock);
#include "pthread_impl.h"
-int pthread_rwlock_unlock(pthread_rwlock_t *rw)
+int __pthread_rwlock_unlock(pthread_rwlock_t *rw)
{
int val, cnt, waiters, new, priv = rw->_rw_shared^128;
return 0;
}
+
+weak_alias(__pthread_rwlock_unlock, pthread_rwlock_unlock);
#include "pthread_impl.h"
-int pthread_rwlock_wrlock(pthread_rwlock_t *rw)
+int __pthread_rwlock_wrlock(pthread_rwlock_t *rw)
{
- return pthread_rwlock_timedwrlock(rw, 0);
+ return __pthread_rwlock_timedwrlock(rw, 0);
}
+
+weak_alias(__pthread_rwlock_wrlock, pthread_rwlock_wrlock);