diff options
author | Jeff Brown <jeffbrown@google.com> | 2010-09-12 17:15:19 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-09-12 17:15:19 -0700 |
commit | 055a7926e651e3f99aedceda3b18bb6ea53d7769 (patch) | |
tree | 1e7afed8ff0231c6b168062fa8f04396d6eb7f2f /libs/utils | |
parent | b7070deffbccc69a5db6540cb558ca6c745b6b20 (diff) | |
parent | 0162133795f67ce649640e3b9d86dcce1c80864b (diff) | |
download | frameworks_native-055a7926e651e3f99aedceda3b18bb6ea53d7769.zip frameworks_native-055a7926e651e3f99aedceda3b18bb6ea53d7769.tar.gz frameworks_native-055a7926e651e3f99aedceda3b18bb6ea53d7769.tar.bz2 |
am 0f0541e4: am b88102f5: Input dispatcher ANR handling enhancements.
Merge commit '0f0541e40cfef51eb5c3769e53c1aa853b53aaf6'
* commit '0f0541e40cfef51eb5c3769e53c1aa853b53aaf6':
Input dispatcher ANR handling enhancements.
Diffstat (limited to 'libs/utils')
-rw-r--r-- | libs/utils/PollLoop.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/utils/PollLoop.cpp b/libs/utils/PollLoop.cpp index 6d3eeee..fe76cd0 100644 --- a/libs/utils/PollLoop.cpp +++ b/libs/utils/PollLoop.cpp @@ -119,7 +119,8 @@ int32_t PollLoop::pollOnce(int timeoutMillis, int* outEvents, void** outData) { if (outData != NULL) *outData = pending.data; return pending.ident; } - + + // Wait for wakeAndLock() waiters to run then set mPolling to true. mLock.lock(); while (mWaiters != 0) { mResume.wait(mLock); @@ -127,6 +128,7 @@ int32_t PollLoop::pollOnce(int timeoutMillis, int* outEvents, void** outData) { mPolling = true; mLock.unlock(); + // Poll. int32_t result; size_t requestedCount = mRequestedFds.size(); @@ -168,6 +170,7 @@ int32_t PollLoop::pollOnce(int timeoutMillis, int* outEvents, void** outData) { } #endif + // Process the poll results. mPendingCallbacks.clear(); mPendingFds.clear(); mPendingFdsPos = 0; @@ -218,6 +221,7 @@ int32_t PollLoop::pollOnce(int timeoutMillis, int* outEvents, void** outData) { } Done: + // Set mPolling to false and wake up the wakeAndLock() waiters. mLock.lock(); mPolling = false; if (mWaiters != 0) { @@ -357,11 +361,13 @@ ssize_t PollLoop::getRequestIndexLocked(int fd) { void PollLoop::wakeAndLock() { mLock.lock(); + mWaiters += 1; while (mPolling) { wake(); mAwake.wait(mLock); } + mWaiters -= 1; if (mWaiters == 0) { mResume.signal(); |