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

Commit 7b0ba166 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

deliver invalidate messages AFTER other messages

because invalidate messages were always handled first, they
could prevent other messages to get through entirely.
there is no real reason to handle invalidate messages first because
the other messages are very uncommon and won't interfer with
updates.

Change-Id: Ib95cdf35a91407bd2f4d69dd082c5f546e1e0071
parent aefa5786
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -72,14 +72,6 @@ sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout)
            nsecs_t now = systemTime();
            nsecs_t nextEventTime = -1;

            // invalidate messages are always handled first
            if (mInvalidate) {
                mInvalidate = false;
                mInvalidateMessage->when = now;
                result = mInvalidateMessage;
                break;
            }

            LIST::iterator cur(mMessages.begin());
            if (cur != mMessages.end()) {
                result = *cur;
@@ -95,6 +87,14 @@ sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout)
                result = 0;
            }

            // see if we have an invalidate message
            if (mInvalidate) {
                mInvalidate = false;
                mInvalidateMessage->when = now;
                result = mInvalidateMessage;
                break;
            }

            if (timeout >= 0) {
                if (timeoutTime < now) {
                    // we timed-out, return a NULL message