25 ms·
Keep in mind that data races in Java are not undefined behaviour. There are quite a few places where authors of standard library deliberately left out synchroni
by wuch 10y ago
Keep in mind that data races in Java are not undefined behaviour. There are quite a few places where authors of standard library deliberately left out synchronization, for example in String.hashCode.
EDIT: In this case numberGenerator is volatile so it introduces happens-before relations between write and read.