diff options
author | Ronghua Wu <ronghuawu@google.com> | 2015-10-30 15:18:12 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-10-30 15:18:12 +0000 |
commit | 06195062e6b65b342b70cb1299ff278340eba9ff (patch) | |
tree | ffb361f817132e8bc76d63a9905c0b7ca8c0da79 | |
parent | 5f2a15a617a41a300fa2b3d3c2abb77ec7381ee1 (diff) | |
parent | 1d29e126cf152d3400021a2edd5cee123077317e (diff) | |
download | frameworks_av-06195062e6b65b342b70cb1299ff278340eba9ff.zip frameworks_av-06195062e6b65b342b70cb1299ff278340eba9ff.tar.gz frameworks_av-06195062e6b65b342b70cb1299ff278340eba9ff.tar.bz2 |
Merge "ALooper::awaitResponse gets reply and returns immediately if the looper is stopped." into mnc-dr-dev
am: 1d29e126cf
* commit '1d29e126cf152d3400021a2edd5cee123077317e':
ALooper::awaitResponse gets reply and returns immediately if the looper is stopped.
-rw-r--r-- | media/libstagefright/foundation/ALooper.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/media/libstagefright/foundation/ALooper.cpp b/media/libstagefright/foundation/ALooper.cpp index 5c2e9f9..9921636 100644 --- a/media/libstagefright/foundation/ALooper.cpp +++ b/media/libstagefright/foundation/ALooper.cpp @@ -234,31 +234,19 @@ sp<AReplyToken> ALooper::createReplyToken() { // to be called by AMessage::postAndAwaitResponse only status_t ALooper::awaitResponse(const sp<AReplyToken> &replyToken, sp<AMessage> *response) { - { - Mutex::Autolock autoLock(mLock); - if (mThread == NULL) { - return -ENOENT; - } - } - // return status in case we want to handle an interrupted wait Mutex::Autolock autoLock(mRepliesLock); CHECK(replyToken != NULL); - bool gotReply; - bool shouldContinue = true; - while (!(gotReply = replyToken->retrieveReply(response)) && shouldContinue) { - mRepliesCondition.wait(mRepliesLock); - + while (!replyToken->retrieveReply(response)) { { Mutex::Autolock autoLock(mLock); if (mThread == NULL) { - shouldContinue = false; - // continue and try to get potential reply one more time before break the loop + return -ENOENT; } } + mRepliesCondition.wait(mRepliesLock); } - - return gotReply ? OK : -ENOENT; + return OK; } status_t ALooper::postReply(const sp<AReplyToken> &replyToken, const sp<AMessage> &reply) { |