Make Ref fields volatile

Otherwise local shared variables are not safe to use from several threads
This commit is contained in:
Alexander Udalov
2014-04-23 22:43:37 +04:00
parent af421f53da
commit 6b348bfc6e
@@ -20,38 +20,38 @@ public class Ref {
private Ref() {}
public static final class ObjectRef<T> {
public T element;
public volatile T element;
}
public static final class ByteRef {
public byte element;
public volatile byte element;
}
public static final class ShortRef {
public short element;
public volatile short element;
}
public static final class IntRef {
public int element;
public volatile int element;
}
public static final class LongRef {
public long element;
public volatile long element;
}
public static final class FloatRef {
public float element;
public volatile float element;
}
public static final class DoubleRef {
public double element;
public volatile double element;
}
public static final class CharRef {
public char element;
public volatile char element;
}
public static final class BooleanRef {
public boolean element;
public volatile boolean element;
}
}