global integer in the multi-thread application
Hello,
My multithread application shares 1 global integer. There is only one thread which is able to modify the integer. All other threads only read the value. My question is, do I need to protect the global integer? Since only one thread modify it and the command will be only one instruct, I don't think that it needs synchronize. If it's true, why there is atomic_t for integer?
Thanks.
|