diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-08-07 04:50:02 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-08-07 04:50:02 -0400 |
commit | b2b95a58b4326c8a8aa87fdf6e8b0f6421dbaf99 (patch) | |
tree | 6122d5d49391a28499988bfde0444df74dffc837 /src/thread/pthread_mutex_lock.c | |
parent | 188ebf51b4ef58aa0ce0a3a09ed1756d6db2e2dd (diff) | |
download | musl-b2b95a58b4326c8a8aa87fdf6e8b0f6421dbaf99.tar.gz musl-b2b95a58b4326c8a8aa87fdf6e8b0f6421dbaf99.tar.bz2 musl-b2b95a58b4326c8a8aa87fdf6e8b0f6421dbaf99.tar.xz musl-b2b95a58b4326c8a8aa87fdf6e8b0f6421dbaf99.zip |
add fast path for normal mutexes back to pthread_mutex_lock
Diffstat (limited to 'src/thread/pthread_mutex_lock.c')
-rw-r--r-- | src/thread/pthread_mutex_lock.c | 3 |
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); } |