< prev index next >
src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java
Print this page
8225490: Miscellaneous changes imported from jsr166 CVS 2019-09
Reviewed-by: martin, alanb
*** 36,45 ****
--- 36,46 ----
package java.util.concurrent.atomic;
import java.lang.invoke.VarHandle;
import java.util.function.IntBinaryOperator;
import java.util.function.IntUnaryOperator;
+ import jdk.internal.misc.Unsafe;
/**
* An {@code int} value that may be updated atomically. See the
* {@link VarHandle} specification for descriptions of the properties
* of atomic accesses. An {@code AtomicInteger} is used in
*** 56,67 ****
/*
* This class intended to be implemented using VarHandles, but there
* are unresolved cyclic startup dependencies.
*/
! private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
! private static final long VALUE = U.objectFieldOffset(AtomicInteger.class, "value");
private volatile int value;
/**
* Creates a new AtomicInteger with the given initial value.
--- 57,69 ----
/*
* This class intended to be implemented using VarHandles, but there
* are unresolved cyclic startup dependencies.
*/
! private static final Unsafe U = Unsafe.getUnsafe();
! private static final long VALUE
! = U.objectFieldOffset(AtomicInteger.class, "value");
private volatile int value;
/**
* Creates a new AtomicInteger with the given initial value.
< prev index next >