LockWatch: Update to Mutex::timeLock specs am: 51a6319111 am: 7b960a5dc5 am: ffd7edc622
am: 78e800e936
Change-Id: Ide1e3fcbc0fd24457960944bd32384ed993a9aea
diff --git a/services/audioflinger/LockWatch.cpp b/services/audioflinger/LockWatch.cpp
index 21eed6e..3da7a3d 100644
--- a/services/audioflinger/LockWatch.cpp
+++ b/services/audioflinger/LockWatch.cpp
@@ -32,8 +32,12 @@
while (!exitPending()) {
// we neglect previous lock time effect on period
usleep(mPeriodMs * 1000);
- if (mLock.timedLock(milliseconds(mTimeOutMs)) != NO_ERROR) {
- LOG_ALWAYS_FATAL("LockWatch timeout for: %s", mTag.string());
+ if (mLock.timedLock(ms2ns(mTimeOutMs)) != NO_ERROR) {
+ // FIXME: Current implementation of timedLock uses CLOCK_REALTIME which
+ // increments even during CPU suspend. Check twice to be sure.
+ if (mLock.timedLock(ms2ns(mTimeOutMs)) != NO_ERROR) {
+ LOG_ALWAYS_FATAL("LockWatch timeout for: %s", mTag.string());
+ }
}
mLock.unlock();
}