summaryrefslogtreecommitdiffstats
path: root/runtime/base
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-10-23 17:48:20 -0700
committerIan Rogers <irogers@google.com>2014-10-23 17:49:51 -0700
commit51d212ef31945743abe8a469707aaa25bab95357 (patch)
treea93e362ca61c7d5a6dc8521551241106ff1248b2 /runtime/base
parente8bd8ac7fb41545ef342c8120c2e83d2fef20a50 (diff)
downloadart-51d212ef31945743abe8a469707aaa25bab95357.tar.gz
art-51d212ef31945743abe8a469707aaa25bab95357.tar.bz2
art-51d212ef31945743abe8a469707aaa25bab95357.zip
Make out-of-line mutex contention dependent on ART_USE_FUTEXES.
Fix Mac build. Also fix Linux compilation if ART_USE_FUTEXES is disabled. Change-Id: I51cb1d70b5548ea6121ff7567b9546bad0894e01
Diffstat (limited to 'runtime/base')
-rw-r--r--runtime/base/mutex.cc4
-rw-r--r--runtime/base/mutex.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc
index 6362a989ae..423ea77da9 100644
--- a/runtime/base/mutex.cc
+++ b/runtime/base/mutex.cc
@@ -646,6 +646,7 @@ bool ReaderWriterMutex::ExclusiveLockWithTimeout(Thread* self, int64_t ms, int32
}
#endif
+#if ART_USE_FUTEXES
void ReaderWriterMutex::HandleSharedLockContention(Thread* self, int32_t cur_state) {
// Owner holds it exclusively, hang up.
ScopedContentionRecorder scr(this, GetExclusiveOwnerTid(), SafeGetTid(self));
@@ -657,6 +658,7 @@ void ReaderWriterMutex::HandleSharedLockContention(Thread* self, int32_t cur_sta
}
--num_pending_readers_;
}
+#endif
bool ReaderWriterMutex::SharedTryLock(Thread* self) {
DCHECK(self == NULL || self == Thread::Current());
@@ -726,7 +728,7 @@ ConditionVariable::ConditionVariable(const char* name, Mutex& guard)
CHECK_MUTEX_CALL(pthread_condattr_init, (&cond_attrs));
#if !defined(__APPLE__)
// Apple doesn't have CLOCK_MONOTONIC or pthread_condattr_setclock.
- CHECK_MUTEX_CALL(pthread_condattr_setclock(&cond_attrs, CLOCK_MONOTONIC));
+ CHECK_MUTEX_CALL(pthread_condattr_setclock, (&cond_attrs, CLOCK_MONOTONIC));
#endif
CHECK_MUTEX_CALL(pthread_cond_init, (&cond_, &cond_attrs));
#endif
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index 25fdd59f8a..628231a273 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -360,10 +360,10 @@ class LOCKABLE ReaderWriterMutex : public BaseMutex {
virtual void Dump(std::ostream& os) const;
private:
+#if ART_USE_FUTEXES
// Out-of-inline path for handling contention for a SharedLock.
void HandleSharedLockContention(Thread* self, int32_t cur_state);
-#if ART_USE_FUTEXES
// -1 implies held exclusive, +ve shared held by state_ many owners.
AtomicInteger state_;
// Exclusive owner. Modification guarded by this mutex.