From 4fae14f3335375714be3104742fa69fe65b02001 Mon Sep 17 00:00:00 2001 From: Ken Mixter Date: Tue, 17 Dec 2013 12:40:08 -0800 Subject: [PATCH] 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 --- libc/bionic/pthread_mutex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp index 1010f11d4..4a11747c3 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;