Atomic operations. More...
#include <stdint.h>
#include <windows.h>
Macros | |
#define | atomic_int32 volatile int32_t |
Integer type for atomic operations. (int32) | |
#define | atomic_int64 volatile int64_t |
Integer type for atomic operations. (int64) | |
#define | atomicFetchAdd32(memory, value) InterlockedExchangeAdd(memory, value) |
Atomically adds the value to the variable that memory points to. | |
#define | atomicFetchAdd64(memory, value) InterlockedExchangeAdd64(memory, value) |
Atomically adds the value to the variable that memory points to. | |
Atomic operations.
Atomic operations are used to perform certain operations in a way that is guaranteed to be indivisible and not subject to interruption by other threads. This is particularly useful in multithreaded programming to avoid race conditions and ensure correct behavior when multiple threads are concurrently accessing shared data.
#define atomicFetchAdd32 | ( | memory, | |
value ) InterlockedExchangeAdd(memory, value) |
Atomically adds the value to the variable that memory points to.
Result is stored in the address that is specified by memory.
[in] | memory | pointer of a variable to which value is to be added. |
value | variable whose value is to be added to the variable that memory points to. |
#define atomicFetchAdd64 | ( | memory, | |
value ) InterlockedExchangeAdd64(memory, value) |
Atomically adds the value to the variable that memory points to.
Result is stored in the address that is specified by memory.
[in] | memory | pointer of a variable to which value is to be added. |
value | variable whose value is to be added to the variable that memory points to. |