C++ Language/Std/Multithreading/AtomicValues

If the only content of a critical section is the manipulation of one variable, then the easiest synchronization approach would be to use  and its associated arithmetic functions.

Additional information about atomic values