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

Commit c4906b66 authored by Shai Barack's avatar Shai Barack Committed by Android (Google) Code Review
Browse files

Merge "removeSyncBarrier doesn't need to wake up Looper if on Looper thread" into main

parents 2f650b5e 250af847
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1274,14 +1274,14 @@ public final class MessageQueue {
        final MatchBarrierToken matchBarrierToken = new MatchBarrierToken(token);

        removed = findOrRemoveMessages(null, 0, null, null, 0, matchBarrierToken, true);
        if (removed) {
            // Wake up next() in case it was sleeping on this barrier.
            // TODO(b/427541521): optimize wakeup logic to only wake up if we are blocked.
            concurrentWake();
        } else {
        if (!removed) {
            throw new IllegalStateException("The specified message queue synchronization "
                    + " barrier token has not been posted or has already been removed.");
        }
        if (Thread.currentThread() != mLooperThread) {
            // Wake up next() in case it was sleeping on this barrier.
            concurrentWake();
        }
    }

    private void removeSyncBarrierLegacy(int token) {