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

Commit bc6c13d8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Document why we use VarHandle directly rather than Atomics" into main

parents 2772ec92 87306201
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2608,6 +2608,8 @@ public final class MessageQueue {
        private volatile boolean mRemovedFromStackValue;
        static {
            try {
                // We need to use VarHandle rather than java.util.concurrent.atomic.*
                // for performance reasons. See: b/421437036
                MethodHandles.Lookup l = MethodHandles.lookup();
                sRemovedFromStack = l.findVarHandle(MessageQueue.MessageNode.class,
                        "mRemovedFromStackValue", boolean.class);
@@ -2681,6 +2683,8 @@ public final class MessageQueue {

    static {
        try {
            // We need to use VarHandle rather than java.util.concurrent.atomic.*
            // for performance reasons. See: b/421437036
            MethodHandles.Lookup l = MethodHandles.lookup();
            sState = l.findVarHandle(MessageQueue.class, "mStateValue",
                    MessageQueue.StackNode.class);
@@ -2803,6 +2807,8 @@ public final class MessageQueue {
        private volatile long mCountsValue = 0;
        static {
            try {
                // We need to use VarHandle rather than java.util.concurrent.atomic.*
                // for performance reasons. See: b/421437036
                MethodHandles.Lookup l = MethodHandles.lookup();
                sCounts = l.findVarHandle(MessageQueue.MessageCounts.class, "mCountsValue",
                        long.class);