summaryrefslogtreecommitdiff
path: root/runtime/base/mutex.cc
diff options
context:
space:
mode:
author Josh Gao <jmgao@google.com> 2018-10-17 16:03:42 -0700
committer Josh Gao <jmgao@google.com> 2018-10-17 16:03:42 -0700
commit2d899c41ac389ab881a56a82380e7bdb91fbbcc8 (patch)
treecc0a13d666ad7b767f76261e1917a1f7039d8cd6 /runtime/base/mutex.cc
parent6e82b7e6726d2c2ed0d6754ce1557d00e051b52c (diff)
Fix usages of TEMP_FAILURE_RETRY(pthread_foo(...)).
pthread functions don't return -1 and set errno on failure, they return a positive errno value instead. Test: treehugger Change-Id: I0097660e44c86c4c49d642e1169a30e43f9662bf
Diffstat (limited to 'runtime/base/mutex.cc')
-rw-r--r--runtime/base/mutex.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc
index b2ddff3f6a..c11e3d1e6e 100644
--- a/runtime/base/mutex.cc
+++ b/runtime/base/mutex.cc
@@ -1028,7 +1028,11 @@ bool ConditionVariable::TimedWait(Thread* self, int64_t ms, int32_t ns) {
guard_.recursion_count_ = 0;
timespec ts;
InitTimeSpec(true, clock, ms, ns, &ts);
- int rc = TEMP_FAILURE_RETRY(pthread_cond_timedwait(&cond_, &guard_.mutex_, &ts));
+ int rc;
+ while ((rc = pthread_cond_timedwait(&cond_, &guard_.mutex_, &ts)) == EINTR) {
+ continue;
+ }
+
if (rc == ETIMEDOUT) {
timed_out = true;
} else if (rc != 0) {