https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89899
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- With the MSVC compiler 'volatile' has additional non-standard semantics. You need to use locks or atomics for other compilers. http://isvolatileusefulwiththreads.in/c++