LockWatch: Update to Mutex::timeLock specs
Bug: 31008450
Change-Id: Ib86e3a385379e222f5c3eb07a36bba9e5b6f5625
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();
}