I have two threads, one updating an int and one reading it. This value is a statistic where the order of the read and write is irrelevant.
My question is, do I need to synchronize access to this multi-byte value anyway? Or, put another way, can part of the write be complete and get interrupted, and then the read happen.
For example, think of
value = ox0000FFFF increment value to 0x00010000
Is there a time where the value looks like 0x0001FFFF that I should be worried about? Certainly the larger the type, the more possible something like this is
I've always synchronized these types of accesses, but was curious what the community thought.