summaryrefslogtreecommitdiffstats
path: root/libc/bionic/pthread_mutex.cpp
diff options
context:
space:
mode:
authorKen Mixter <kmixter@google.com>2013-12-17 12:40:08 -0800
committerKen Mixter <kmixter@google.com>2013-12-17 14:26:01 -0800
commit4fae14f3335375714be3104742fa69fe65b02001 (patch)
treebdf4e9cd74914f6b6a506ee1a65ac0634a556f73 /libc/bionic/pthread_mutex.cpp
parent3377165387d455d4cb56807a9c02cd2ece6cb24b (diff)
downloadbionic-4fae14f3335375714be3104742fa69fe65b02001.zip
bionic-4fae14f3335375714be3104742fa69fe65b02001.tar.gz
bionic-4fae14f3335375714be3104742fa69fe65b02001.tar.bz2
Properly detect timeout in pthread_mutex_lock_timeout_np_impl
Previously we were checking against a positive errno which would not be returned from a system call. Change-Id: I8e3a36f6fbf5ccc2191a152a1def37e2d6f93124
Diffstat (limited to 'libc/bionic/pthread_mutex.cpp')
-rw-r--r--libc/bionic/pthread_mutex.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp
index 1010f11..4a11747 100644
--- a/libc/bionic/pthread_mutex.cpp
+++ b/libc/bionic/pthread_mutex.cpp
@@ -800,7 +800,7 @@ int pthread_mutex_lock_timeout_np_impl(pthread_mutex_t *mutex, unsigned msecs)
* thread.
*/
if (MUTEX_STATE_BITS_IS_LOCKED_CONTENDED(mvalue)) {
- if (__futex_wait_ex(&mutex->value, shared, mvalue, &ts) == ETIMEDOUT) {
+ if (__futex_wait_ex(&mutex->value, shared, mvalue, &ts) == (-ETIMEDOUT)) {
return EBUSY;
}
mvalue = mutex->value;