Hi guys. I've a too simple question.
I have an int variable which is accesed by two threads. One simply increases it at certain times, the other simply reads it's value.
Should I implement a CCriticalSection or it's unnecessary??? I'm not sure what can happen when reading a variable whose value is being incremented, or perhaps this is an atomic affair?Code:// thread 1 m_MyVar++; //thread 2 if(m_MyVar < MyOtherVar) ... else ...
Thanks in advance.