Hello!

Suppose I have a given varible, such as a boolean working as a flag, that need to be both written and read in the same thread. Is it possible for the some kind of problem happen because of the possibility of this variable has its value read and changed "at the same time" inside the same thread? And when its value is altered by a signal emitted from another thread? (For example, I create a QThread based class that, when the finished() signal is emitted, it alters a boolean flag on its parent indicating that the thread has stoped running, but the value of that boolean flag may be read at any time by the parent object to verify that state).

Just to give a context, I'm trying to know this because I have a similar situation as described inside the parenthesis above, but for now Im using isRunning() to verify for the current's thread state and this is not very good, since the pointer to my thread may be deleted ("delete poThread") at any time, what makes necessary to use QSemaphores, what I want to avoid).


Hope I was clear enough


Momergil