about summary refs log tree commit diff
path: root/src/thread
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/pthread_key_create.c18
-rw-r--r--src/thread/pthread_rwlock_rdlock.c6
-rw-r--r--src/thread/pthread_rwlock_timedrdlock.c6
-rw-r--r--src/thread/pthread_rwlock_timedwrlock.c6
-rw-r--r--src/thread/pthread_rwlock_tryrdlock.c4
-rw-r--r--src/thread/pthread_rwlock_trywrlock.c4
-rw-r--r--src/thread/pthread_rwlock_unlock.c4
-rw-r--r--src/thread/pthread_rwlock_wrlock.c6
8 files changed, 34 insertions, 20 deletions
diff --git a/src/thread/pthread_key_create.c b/src/thread/pthread_key_create.c
index da1fb116..dc20cc3f 100644
--- a/src/thread/pthread_key_create.c
+++ b/src/thread/pthread_key_create.c
@@ -32,16 +32,16 @@ int __pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
 	/* 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;
 }
 
@@ -57,9 +57,9 @@ int __pthread_key_delete(pthread_key_t k)
 	__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;
 }
@@ -69,19 +69,19 @@ void __pthread_tsd_run_dtors()
 	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);
 	}
 }
 
diff --git a/src/thread/pthread_rwlock_rdlock.c b/src/thread/pthread_rwlock_rdlock.c
index 0800d21f..8546c07d 100644
--- a/src/thread/pthread_rwlock_rdlock.c
+++ b/src/thread/pthread_rwlock_rdlock.c
@@ -1,6 +1,8 @@
 #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);
diff --git a/src/thread/pthread_rwlock_timedrdlock.c b/src/thread/pthread_rwlock_timedrdlock.c
index 0d5d0d6c..8cdd8ecf 100644
--- a/src/thread/pthread_rwlock_timedrdlock.c
+++ b/src/thread/pthread_rwlock_timedrdlock.c
@@ -1,6 +1,6 @@
 #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;
 
@@ -10,7 +10,7 @@ int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict rw, const struct times
 	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);
@@ -21,3 +21,5 @@ int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict rw, const struct times
 	}
 	return r;
 }
+
+weak_alias(__pthread_rwlock_timedrdlock, pthread_rwlock_timedrdlock);
diff --git a/src/thread/pthread_rwlock_timedwrlock.c b/src/thread/pthread_rwlock_timedwrlock.c
index 7f26dad1..d77706e6 100644
--- a/src/thread/pthread_rwlock_timedwrlock.c
+++ b/src/thread/pthread_rwlock_timedwrlock.c
@@ -1,6 +1,6 @@
 #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;
 	
@@ -10,7 +10,7 @@ int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rw, const struct times
 	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);
@@ -21,3 +21,5 @@ int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rw, const struct times
 	}
 	return r;
 }
+
+weak_alias(__pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock);
diff --git a/src/thread/pthread_rwlock_tryrdlock.c b/src/thread/pthread_rwlock_tryrdlock.c
index fa271fcc..c13bc9cc 100644
--- a/src/thread/pthread_rwlock_tryrdlock.c
+++ b/src/thread/pthread_rwlock_tryrdlock.c
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
+int __pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
 {
 	int val, cnt;
 	do {
@@ -11,3 +11,5 @@ int pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
 	} while (a_cas(&rw->_rw_lock, val, val+1) != val);
 	return 0;
 }
+
+weak_alias(__pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock);
diff --git a/src/thread/pthread_rwlock_trywrlock.c b/src/thread/pthread_rwlock_trywrlock.c
index bb3d3a99..64d9d312 100644
--- a/src/thread/pthread_rwlock_trywrlock.c
+++ b/src/thread/pthread_rwlock_trywrlock.c
@@ -1,7 +1,9 @@
 #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);
diff --git a/src/thread/pthread_rwlock_unlock.c b/src/thread/pthread_rwlock_unlock.c
index 7b5eec84..9ae27ad2 100644
--- a/src/thread/pthread_rwlock_unlock.c
+++ b/src/thread/pthread_rwlock_unlock.c
@@ -1,6 +1,6 @@
 #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;
 
@@ -16,3 +16,5 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rw)
 
 	return 0;
 }
+
+weak_alias(__pthread_rwlock_unlock, pthread_rwlock_unlock);
diff --git a/src/thread/pthread_rwlock_wrlock.c b/src/thread/pthread_rwlock_wrlock.c
index 7f33535c..46a3b3a5 100644
--- a/src/thread/pthread_rwlock_wrlock.c
+++ b/src/thread/pthread_rwlock_wrlock.c
@@ -1,6 +1,8 @@
 #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);