2 ms·
> Reading ad-hoc is fine if you just want to observe the value at some point in time. There are such cases, indeed. Double-checked locking comes to mind. But i
by MauranKilom 4y ago
> Reading ad-hoc is fine if you just want to observe the value at some point in time.
There are such cases, indeed. Double-checked locking comes to mind. But if the code inside the if does assume the atomic to have a given value, it is almost surely wrong (absent of other synchronization mechanisms, such as in double-checked locking).