MSDN says that the interlocked functions provide a simple mechanism for synchronizing access to a variable that is shared by multiple threads.
I am not sure if they work across threads of multiple processes if the variable is in the shared memory of the processes.
Similarly what about GNU GCC compiler intrinsic: __sync_add_and_fetch and __sync_lock_test_and_set?