Interlocked equivalent on Linux

atomic, c++, linux, multithreading

Solution

Upon further review, this looks promising. Yay stack overflow.

Problem

In a C++ Linux app, what is the simplest way to get the functionality that the Interlocked functions on Win32 provide? Specifically, a lightweight way to atomically increment or add 32 or 64 bit integers?

Original source