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