I have a multi-threaded C++ app which does 3D rendering with the OpenSceneGraph library. I\'m planning to kick off OSG\'s render loop as a separate thread using boost::threa
As for C++11 and later it is finally threads-aware and clearly states that modifying a bool (or other non-atomic variable) in one thread and accessing it at the same time in another one is undefined behavior.
In you case using std::atomic should be enough to make your program correct, saving you from using locks.
Do not use volatile. It has nothing to do with threads.
For more discussion look at Can I read a bool variable in a thread without mutex?