audioflinger: check for condition before waiting
AsyncCallbackThread must check for any condition that
was already been satisfied before waiting.
Bug: 11824817
Change-Id: I04683a1f355de4f440106cab47fd916aa39d5e35
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 64d7ec3..110e45c 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -3863,7 +3863,12 @@
{
Mutex::Autolock _l(mLock);
- mWaitWorkCV.wait(mLock);
+ while (!((mWriteAckSequence & 1) ||
+ (mDrainSequence & 1) ||
+ exitPending())) {
+ mWaitWorkCV.wait(mLock);
+ }
+
if (exitPending()) {
break;
}