summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-08-07 04:50:02 -0400
committerRich Felker <dalias@aerifal.cx>2011-08-07 04:50:02 -0400
commitb2b95a58b4326c8a8aa87fdf6e8b0f6421dbaf99 (patch)
tree6122d5d49391a28499988bfde0444df74dffc837
parent188ebf51b4ef58aa0ce0a3a09ed1756d6db2e2dd (diff)
downloadmusl-b2b95a58b4326c8a8aa87fdf6e8b0f6421dbaf99.tar.gz
add fast path for normal mutexes back to pthread_mutex_lock
-rw-r--r--src/thread/pthread_mutex_lock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/thread/pthread_mutex_lock.c b/src/thread/pthread_mutex_lock.c
index 2b4f3a73..42b5af64 100644
--- a/src/thread/pthread_mutex_lock.c
+++ b/src/thread/pthread_mutex_lock.c
@@ -2,5 +2,8 @@
int pthread_mutex_lock(pthread_mutex_t *m)
{
+ if (m->_m_type == PTHREAD_MUTEX_NORMAL && !a_cas(&m->_m_lock, 0, EBUSY))
+ return 0;
+
return pthread_mutex_timedlock(m, 0);
}