411 REFERENCE · Wikibooks
C++ Language/Std/Multithreading/AtomicValues
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
If the only content of a critical section is the manipulation of one variable, then the easiest synchronization approach would be to use std::atomic<> and its associated arithmetic functions.
Additional information about atomic values