title: C++98: is volatile needed for access to shared global objects in a multithreaded application
body: <p>Sadly I'm stuck with C++98, which I'm using in an embedded application.</p>
  <p>My question is: I have a multithreaded application, with various global shared variables (evil, I know).
  I do protect every access to them using mutexes. Do I also need to declare these global variables as volatile, in order to prevent the compiler from optimizing accesses to them?</p>
  <p>Searching online it seems that volatile is absolutely useless for multithreading,  but a lot of articles are related to C++11, which did introduce a memory model which recognizes threads, but I'm in C++98 land.
  I also found some resources that indicate that volatile is instead useful in my case, such as <a href="https://barrgroup.com/embedded-systems/how-to/c-volatile-keyword" rel="nofollow noreferrer">this Barr Group's article</a>.</p>
  <p>Let me emphasize the fact that I don't want to get rid of the mutexes at all, or try lock free programming. The mutexes are absolutely staying, I just want to understand if the volatile keyword is needed.</p>