I have two threads, one of which updates int and one reads it. This is a statistical value in which the reading and writing order does not matter.
My question is: do I need to synchronize access to this multibyte value? Or, in another way, part of the record may be filled and interrupted, and then reading will occur.
For example, think of a value = 0x0000FFFF that gets an increased value of 0x00010000.
Is there a time when the value looks like 0x0001FFFF that I have to worry about? Of course, the larger the type, the more likely something like that.
I always synchronized these types of access, but I was curious what the community was thinking.
c ++ multithreading synchronization
theschmitzer Sep 10 '08 at 14:26 2008-09-10 14:26
source share