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

Commit 8a56bb70 authored by Dan Stoza's avatar Dan Stoza Committed by Android (Google) Code Review
Browse files

Merge "DispSync: Actually wait forever" into nyc-dev

parents ef6f4f0b 8f8374d7
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -97,7 +97,6 @@ public:
    virtual bool threadLoop() {
        status_t err;
        nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
        nsecs_t nextEventTime = 0;

        while (true) {
            Vector<CallbackInvocation> callbackInvocations;
@@ -127,16 +126,21 @@ public:
                    continue;
                }

                nextEventTime = computeNextEventTimeLocked(now);
                targetTime = nextEventTime;
                targetTime = computeNextEventTimeLocked(now);

                bool isWakeup = false;

                if (now < targetTime) {
                    if (kTraceDetailedInfo) ATRACE_NAME("DispSync waiting");

                    if (targetTime == INT64_MAX) {
                        ALOGV("[%s] Waiting forever", mName);
                        err = mCond.wait(mMutex);
                    } else {
                        ALOGV("[%s] Waiting until %" PRId64, mName,
                                ns2us(targetTime));
                    if (kTraceDetailedInfo) ATRACE_NAME("DispSync waiting");
                        err = mCond.waitRelative(mMutex, targetTime - now);
                    }

                    if (err == TIMED_OUT) {
                        isWakeup = true;