mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-21 04:50:58 +07:00
11 lines
307 B
Java
11 lines
307 B
Java
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
|
|
|
|
class Atomics {
|
|
private volatile long num;
|
|
private static final AtomicLongFieldUpdater<Atomics> updater =
|
|
(AtomicLongFieldUpdater.newUpdater(Atomics.class, "num"));
|
|
|
|
public void init(long n) {
|
|
updater.compareAndSet(this, 0, n);
|
|
}
|
|
} |