src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.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.IntBinaryOperator;
    39 import java.util.function.IntBinaryOperator;
    40 import java.util.function.IntUnaryOperator;
    40 import java.util.function.IntUnaryOperator;
       
    41 import jdk.internal.misc.Unsafe;
    41 
    42 
    42 /**
    43 /**
    43  * An {@code int} value that may be updated atomically.  See the
    44  * An {@code int} 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 AtomicInteger} is used in
    46  * of atomic accesses. An {@code AtomicInteger} is used in
    56 
    57 
    57     /*
    58     /*
    58      * This class intended to be implemented using VarHandles, but there
    59      * This class intended to be implemented using VarHandles, but there
    59      * are unresolved cyclic startup dependencies.
    60      * are unresolved cyclic startup dependencies.
    60      */
    61      */
    61     private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
    62     private static final Unsafe U = Unsafe.getUnsafe();
    62     private static final long VALUE = U.objectFieldOffset(AtomicInteger.class, "value");
    63     private static final long VALUE
       
    64         = U.objectFieldOffset(AtomicInteger.class, "value");
    63 
    65 
    64     private volatile int value;
    66     private volatile int value;
    65 
    67 
    66     /**
    68     /**
    67      * Creates a new AtomicInteger with the given initial value.
    69      * Creates a new AtomicInteger with the given initial value.