about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-06-10 04:02:40 -0400
committerRich Felker <dalias@aerifal.cx>2014-06-10 04:02:40 -0400
commitdf15168cf8baf34fb9c94e19eaa1a5c79c853970 (patch)
tree83a61274604cb4b4ed65e617d03d687666cb84c3
parent64e32287f9d8a84217834bcc3387e9431cad9e4c (diff)
downloadmusl-df15168cf8baf34fb9c94e19eaa1a5c79c853970.tar.gz
musl-df15168cf8baf34fb9c94e19eaa1a5c79c853970.tar.xz
musl-df15168cf8baf34fb9c94e19eaa1a5c79c853970.zip
replace all remaining internal uses of pthread_self with __pthread_self
prior to version 1.1.0, the difference between pthread_self (the
public function) and __pthread_self (the internal macro or inline
function) was that the former would lazily initialize the thread
pointer if it was not already initialized, whereas the latter would
crash in this case. since lazy initialization is no longer supported,
use of pthread_self no longer makes sense; it simply generates larger,
slower code.
-rw-r--r--src/locale/uselocale.c2
-rw-r--r--src/stdio/ftrylockfile.c2
-rw-r--r--src/thread/cancel_impl.c2
-rw-r--r--src/thread/pthread_cond_broadcast.c2
-rw-r--r--src/thread/pthread_cond_timedwait.c2
-rw-r--r--src/thread/pthread_create.c4
-rw-r--r--src/thread/pthread_mutex_consistent.c2
-rw-r--r--src/thread/pthread_mutex_timedlock.c2
-rw-r--r--src/thread/pthread_mutex_trylock.c2
-rw-r--r--src/thread/pthread_mutex_unlock.c2
-rw-r--r--src/thread/pthread_setcanceltype.c2
11 files changed, 12 insertions, 12 deletions
diff --git a/src/locale/uselocale.c b/src/locale/uselocale.c
index 224ef387..4fc5c64e 100644
--- a/src/locale/uselocale.c
+++ b/src/locale/uselocale.c
@@ -4,7 +4,7 @@
 
 locale_t uselocale(locale_t l)
 {
-	pthread_t self = pthread_self();
+	pthread_t self = __pthread_self();
 	locale_t old = self->locale;
 	if (l) self->locale = l;
 	return old;
diff --git a/src/stdio/ftrylockfile.c b/src/stdio/ftrylockfile.c
index eef4e250..56cccafd 100644
--- a/src/stdio/ftrylockfile.c
+++ b/src/stdio/ftrylockfile.c
@@ -4,7 +4,7 @@
 
 int ftrylockfile(FILE *f)
 {
-	int tid = pthread_self()->tid;
+	int tid = __pthread_self()->tid;
 	if (f->lock == tid) {
 		if (f->lockcount == LONG_MAX)
 			return -1;
diff --git a/src/thread/cancel_impl.c b/src/thread/cancel_impl.c
index 525d2904..41cf2b8c 100644
--- a/src/thread/cancel_impl.c
+++ b/src/thread/cancel_impl.c
@@ -58,7 +58,7 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx)
 void __testcancel()
 {
 	if (!libc.has_thread_pointer) return;
-	pthread_t self = pthread_self();
+	pthread_t self = __pthread_self();
 	if (self->cancel && !self->canceldisable)
 		__cancel();
 }
diff --git a/src/thread/pthread_cond_broadcast.c b/src/thread/pthread_cond_broadcast.c
index 848e288f..0901daf6 100644
--- a/src/thread/pthread_cond_broadcast.c
+++ b/src/thread/pthread_cond_broadcast.c
@@ -28,7 +28,7 @@ int pthread_cond_broadcast(pthread_cond_t *c)
 	/* Perform the futex requeue, waking one waiter unless we know
 	 * that the calling thread holds the mutex. */
 	__syscall(SYS_futex, &c->_c_seq, FUTEX_REQUEUE,
-		!m->_m_type || (m->_m_lock&INT_MAX)!=pthread_self()->tid,
+		!m->_m_type || (m->_m_lock&INT_MAX)!=__pthread_self()->tid,
 		INT_MAX, &m->_m_lock);
 
 out:
diff --git a/src/thread/pthread_cond_timedwait.c b/src/thread/pthread_cond_timedwait.c
index 1f25c8e7..99d62cca 100644
--- a/src/thread/pthread_cond_timedwait.c
+++ b/src/thread/pthread_cond_timedwait.c
@@ -41,7 +41,7 @@ int pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restrict
 	struct cm cm = { .c=c, .m=m };
 	int r, e=0, seq;
 
-	if (m->_m_type && (m->_m_lock&INT_MAX) != pthread_self()->tid)
+	if (m->_m_type && (m->_m_lock&INT_MAX) != __pthread_self()->tid)
 		return EPERM;
 
 	if (ts && ts->tv_nsec >= 1000000000UL)
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index e0b5ef16..7a2f172c 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -13,7 +13,7 @@ weak_alias(dummy_0, __pthread_tsd_run_dtors);
 
 _Noreturn void pthread_exit(void *result)
 {
-	pthread_t self = pthread_self();
+	pthread_t self = __pthread_self();
 	sigset_t set;
 
 	self->result = result;
@@ -78,7 +78,7 @@ _Noreturn void pthread_exit(void *result)
 void __do_cleanup_push(struct __ptcb *cb)
 {
 	if (!libc.has_thread_pointer) return;
-	struct pthread *self = pthread_self();
+	struct pthread *self = __pthread_self();
 	cb->__next = self->cancelbuf;
 	self->cancelbuf = cb;
 }
diff --git a/src/thread/pthread_mutex_consistent.c b/src/thread/pthread_mutex_consistent.c
index 7dfb904f..65da29fa 100644
--- a/src/thread/pthread_mutex_consistent.c
+++ b/src/thread/pthread_mutex_consistent.c
@@ -3,7 +3,7 @@
 int pthread_mutex_consistent(pthread_mutex_t *m)
 {
 	if (m->_m_type < 8) return EINVAL;
-	if ((m->_m_lock & 0x3fffffff) != pthread_self()->tid)
+	if ((m->_m_lock & 0x3fffffff) != __pthread_self()->tid)
 		return EPERM;
 	m->_m_type -= 8;
 	return 0;
diff --git a/src/thread/pthread_mutex_timedlock.c b/src/thread/pthread_mutex_timedlock.c
index c24270d8..7b1afc02 100644
--- a/src/thread/pthread_mutex_timedlock.c
+++ b/src/thread/pthread_mutex_timedlock.c
@@ -10,7 +10,7 @@ int pthread_mutex_timedlock(pthread_mutex_t *restrict m, const struct timespec *
 	while ((r=pthread_mutex_trylock(m)) == EBUSY) {
 		if (!(r=m->_m_lock) || (r&0x40000000)) continue;
 		if ((m->_m_type&3) == PTHREAD_MUTEX_ERRORCHECK
-		 && (r&0x1fffffff) == pthread_self()->tid)
+		 && (r&0x1fffffff) == __pthread_self()->tid)
 			return EDEADLK;
 
 		a_inc(&m->_m_waiters);
diff --git a/src/thread/pthread_mutex_trylock.c b/src/thread/pthread_mutex_trylock.c
index db784a73..00ad65de 100644
--- a/src/thread/pthread_mutex_trylock.c
+++ b/src/thread/pthread_mutex_trylock.c
@@ -8,7 +8,7 @@ int pthread_mutex_trylock(pthread_mutex_t *m)
 	if (m->_m_type == PTHREAD_MUTEX_NORMAL)
 		return a_cas(&m->_m_lock, 0, EBUSY) & EBUSY;
 
-	self = pthread_self();
+	self = __pthread_self();
 	tid = self->tid;
 
 	if (m->_m_type >= 4) {
diff --git a/src/thread/pthread_mutex_unlock.c b/src/thread/pthread_mutex_unlock.c
index 5fc0f4e5..b4bd74b8 100644
--- a/src/thread/pthread_mutex_unlock.c
+++ b/src/thread/pthread_mutex_unlock.c
@@ -13,7 +13,7 @@ int pthread_mutex_unlock(pthread_mutex_t *m)
 	if (m->_m_type != PTHREAD_MUTEX_NORMAL) {
 		if (!m->_m_lock)
 			return EPERM;
-		self = pthread_self();
+		self = __pthread_self();
 		if ((m->_m_lock&0x1fffffff) != self->tid)
 			return EPERM;
 		if ((m->_m_type&3) == PTHREAD_MUTEX_RECURSIVE && m->_m_count)
diff --git a/src/thread/pthread_setcanceltype.c b/src/thread/pthread_setcanceltype.c
index ce2fff07..bf0a3f38 100644
--- a/src/thread/pthread_setcanceltype.c
+++ b/src/thread/pthread_setcanceltype.c
@@ -2,7 +2,7 @@
 
 int pthread_setcanceltype(int new, int *old)
 {
-	struct pthread *self = pthread_self();
+	struct pthread *self = __pthread_self();
 	if (new > 1U) return EINVAL;
 	if (old) *old = self->cancelasync;
 	self->cancelasync = new;