Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d5ed611 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am a7c76d83: Merge "fix a bug where timeouts would only be handled when a...

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
parents bb798138 7f5b5a8e
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -91,19 +91,23 @@ 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 (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;
                }
            }

            if (nextEventTime >= 0) {