Atomic operations
Briefly put, an atomic operation is an operation which the processor can execute with a single instruction. This makes it atomic in the sense that nothing (barring interrupts) can interfere with it, or change any variables or data it may be using.
Applications include guaranteeing the order of instruction execution, lock-free implementations, and related uses where instruction execution order and memory access guarantees are important.
Before the 2011 C++ standard, the access to such atomic operations as provided by the processor was only provided by the compiler, using extensions.
Visual C++
For Microsoft's MSVC compiler there are the interlocked functions, as summarized from the MSDN documentation, starting with the adding features:
Interlocked function | Description |
| Performs an atomic addition operation on the specified |
| Performs an atomic addition operation on the specified |