Let me define safely: doesn't return gibberish. Let's assume i have a variable of any type; for this example i'm using an int and a class
class Example
{
int a;
public:
void set_int(int b) { a = b; }
void do_stuff() { std::cout << a << std::endl; }
}
If one thread unpredictively calls set_int, and another thread periodically calls do_stuff(), in case a collision happens am i simply going to print to console the older value of a (which in my case is still fine), or am i going to see totally unpredictable values on a?
Note that any change made to the class i'm talking about is only a value reassignment, there's no addition of elements to containers or stuff like that, no indexes or iterators involved; just mere values.