Quote Originally Posted by Moore View Post
hello,

In C, if threadA has the ability to read and write to a complex data object and threadB is guaranteed to be read only, does the data object have to be thread safe?

since a writer exists, are you subject to race condition between threads?
But is this the only side effect, or is there the potential for memory volatility/corruption?

thanks.
You risk reading a corrupt object.

Image your "complex data" holds a char array, and an int representing the size.

Method write() changes the array, and THEN changes the int size.
Imagine if method read() were to read said object between those two actions.

Any time you have threads, you cannot read/write an object at the same time. I'm not even sure about simply atomic data like "int".