3 ms·
No, in Java a data race is a well-defined behavior - the observable values of the field are only those that were actually set by any Java thread, also called no
by kaba0 4y ago
No, in Java a data race is a well-defined behavior - the observable values of the field are only those that were actually set by any Java thread, also called no out-of-thin-air values.
This is not generally true of other languages, where it is allowed for the compiler to do whatever it wants in these cases, meaning that once you go down the happy path, nothing can be guaranteed. Also, safe rust preventing data races is again not that big of a thing because if you want to use the same memory region (not read-only) from multiple threads you will have to use unsafe either way.