projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
93cc986
)
avoid function call to pthread_self in mutex unlock
author
Rich Felker
<dalias@aerifal.cx>
Thu, 17 Mar 2011 17:35:08 +0000
(13:35 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Thu, 17 Mar 2011 17:35:08 +0000
(13:35 -0400)
if the mutex was previously locked, we can assume pthread_self was
already called at the time of locking, and thus that the thread
pointer is initialized.
src/thread/pthread_mutex_unlock.c
patch
|
blob
|
history
diff --git
a/src/thread/pthread_mutex_unlock.c
b/src/thread/pthread_mutex_unlock.c
index 61a2b9471b52615ef58e858f29095ed85115be16..3733788d8ebee7a375d54db6959aef1f8702a623 100644
(file)
--- a/
src/thread/pthread_mutex_unlock.c
+++ b/
src/thread/pthread_mutex_unlock.c
@@
-3,7
+3,7
@@
int pthread_mutex_unlock(pthread_mutex_t *m)
{
if (m->_m_type != PTHREAD_MUTEX_NORMAL) {
- if (
m->_m_lock !=
pthread_self()->tid)
+ if (
!m->_m_lock || m->_m_lock != __
pthread_self()->tid)
return EPERM;
if (m->_m_type == PTHREAD_MUTEX_RECURSIVE && --m->_m_count)
return 0;