summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2010-10-11 12:44:23 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2010-10-11 12:44:23 -0700
commit8d5ed611214d500f2761b45ce6477b158f0d0aba (patch)
treed0f9cd06c9da12a52a9e6f2311a9b4eaa9e5c497
parentbb798138871dc4a9e440e1f763a2dd9ce4184394 (diff)
parent7f5b5a8ebfad149af8781de2c7079948c8f78d16 (diff)
am a7c76d83: Merge "fix a bug where timeouts would only be handled when a message was delivered" into gingerbread
Merge commit 'a7c76d8307a3b49bf5b8fdda3543455b0e5dd64c' into gingerbread-plus-aosp * commit 'a7c76d8307a3b49bf5b8fdda3543455b0e5dd64c': fix a bug where timeouts would only be handled when a message was delivered
-rw-r--r--services/surfaceflinger/MessageQueue.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/services/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp
index d668e88d47..4fb1e6133b 100644
--- a/services/surfaceflinger/MessageQueue.cpp
+++ b/services/surfaceflinger/MessageQueue.cpp
@@ -91,17 +91,21 @@ sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout)
mMessages.remove(cur);
break;
}
- if (timeout>=0 && timeoutTime < now) {
- // we timed-out, return a NULL message
- result = 0;
- break;
- }
nextEventTime = result->when;
result = 0;
}
- if (timeout >= 0 && nextEventTime > 0) {
- if (nextEventTime > timeoutTime) {
+ if (timeout >= 0) {
+ if (timeoutTime < now) {
+ // we timed-out, return a NULL message
+ result = 0;
+ break;
+ }
+ if (nextEventTime > 0) {
+ if (nextEventTime > timeoutTime) {
+ nextEventTime = timeoutTime;
+ }
+ } else {
nextEventTime = timeoutTime;
}
}