volatile
signals that the value of stop_
has to be read from the main memory every time it is evaluated.
What could happen if you didn't do that, in the worst case, is to run without stopping, because thread1 sets stop_
to false, but thread2 does only look at his buffered stop
on the CPU cache.
But keep in mind that it must not result in a problem, but it could.