OSDN Git Service

audioflinger: check for condition before waiting
authorHaynes Mathew George <hgeorge@codeaurora.org>
Wed, 4 Dec 2013 05:26:02 +0000 (21:26 -0800)
committerEric Laurent <elaurent@google.com>
Wed, 5 Mar 2014 00:03:12 +0000 (16:03 -0800)
AsyncCallbackThread must check for any condition that
was already been satisfied before waiting.

Bug: 11824817
Change-Id: I04683a1f355de4f440106cab47fd916aa39d5e35

services/audioflinger/Threads.cpp

index 64d7ec3..110e45c 100644 (file)
@@ -3863,7 +3863,12 @@ bool AudioFlinger::AsyncCallbackThread::threadLoop()
 
         {
             Mutex::Autolock _l(mLock);
-            mWaitWorkCV.wait(mLock);
+            while (!((mWriteAckSequence & 1) ||
+                     (mDrainSequence & 1) ||
+                     exitPending())) {
+                mWaitWorkCV.wait(mLock);
+            }
+
             if (exitPending()) {
                 break;
             }