summaryrefslogtreecommitdiff
path: root/src/thread
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-09-27 18:22:31 -0400
committerRich Felker <dalias@aerifal.cx>2011-09-27 18:22:31 -0400
commitbc244533ccd72a0ad075571e338a6af35cc162f5 (patch)
tree17ab555296e9fd6f9c420545f08d04e1ec598b97 /src/thread
parentbfae1a8b713305ec3e65c7d6abd7ad64d5df6363 (diff)
downloadmusl-bc244533ccd72a0ad075571e338a6af35cc162f5.tar.gz
improve/debloat mutex unlock error checking in pthread_cond_wait
we're not required to check this except for error-checking mutexes, but it doesn't hurt. the new test is actually simpler/lighter, and it also eliminates the need to later check that pthread_mutex_unlock succeeds.
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/pthread_cond_timedwait.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/thread/pthread_cond_timedwait.c b/src/thread/pthread_cond_timedwait.c
index faa7c23b..60ebbb97 100644
--- a/src/thread/pthread_cond_timedwait.c
+++ b/src/thread/pthread_cond_timedwait.c
@@ -37,8 +37,8 @@ int pthread_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *m, const struct t
struct cm cm = { .c=c, .m=m };
int r, e=0, seq;
- if ((m->_m_type&3) == PTHREAD_MUTEX_ERRORCHECK &&
- (m->_m_lock&INT_MAX) != __pthread_self()->tid) return EPERM;
+ if (m->_m_type && (m->_m_lock&INT_MAX) != __pthread_self()->tid)
+ return EPERM;
if (ts && ts->tv_nsec >= 1000000000UL)
return EINVAL;
@@ -58,7 +58,7 @@ int pthread_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *m, const struct t
seq = c->_c_seq;
- if ((r=pthread_mutex_unlock(m))) return r;
+ pthread_mutex_unlock(m);
do e = __timedwait(&c->_c_seq, seq, c->_c_clock, ts, cleanup, &cm, 0);
while (c->_c_seq == seq && (!e || e==EINTR));