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