src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java
changeset 58138 1e4270f875ee
parent 55033 c72451a9f67e
equal deleted inserted replaced
58137:6a556bcd94fc 58138:1e4270f875ee
    36 package java.util.concurrent.atomic;
    36 package java.util.concurrent.atomic;
    37 
    37 
    38 import java.lang.invoke.VarHandle;
    38 import java.lang.invoke.VarHandle;
    39 import java.util.function.LongBinaryOperator;
    39 import java.util.function.LongBinaryOperator;
    40 import java.util.function.LongUnaryOperator;
    40 import java.util.function.LongUnaryOperator;
       
    41 import jdk.internal.misc.Unsafe;
    41 
    42 
    42 /**
    43 /**
    43  * A {@code long} value that may be updated atomically.  See the
    44  * A {@code long} value that may be updated atomically.  See the
    44  * {@link VarHandle} specification for descriptions of the properties
    45  * {@link VarHandle} specification for descriptions of the properties
    45  * of atomic accesses. An {@code AtomicLong} is used in applications
    46  * of atomic accesses. An {@code AtomicLong} is used in applications
    70 
    71 
    71     /*
    72     /*
    72      * This class intended to be implemented using VarHandles, but there
    73      * This class intended to be implemented using VarHandles, but there
    73      * are unresolved cyclic startup dependencies.
    74      * are unresolved cyclic startup dependencies.
    74      */
    75      */
    75     private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
    76     private static final Unsafe U = Unsafe.getUnsafe();
    76     private static final long VALUE = U.objectFieldOffset(AtomicLong.class, "value");
    77     private static final long VALUE
       
    78         = U.objectFieldOffset(AtomicLong.class, "value");
    77 
    79 
    78     private volatile long value;
    80     private volatile long value;
    79 
    81 
    80     /**
    82     /**
    81      * Creates a new AtomicLong with the given initial value.
    83      * Creates a new AtomicLong with the given initial value.