Intrinsic functions of the compiler to allow for shared memory synchronization, especially between nodes.
long InterlockedCompareExchange (
long volatile * Destination,
long Exchange,
long Comperand);
short InterlockedCompareExchange16 (
short volatile * Destination,
short Exchange,
short Comperand);
long long InterlockedCompareExchange64 (
long long volatile *Destination,
long long Exchange,
long long Comperand);
long InterlockedDecrement(
long volatile * lpAddend);
short InterlockedDecrement16(
short volatile * Addend);
long long InterlockedDecrement64(
long long volatile * Addend);
long InterlockedExchange(
long volatile * Target,
long Value);
short InterlockedExchange16(
short volatile * Target,
short Value);
long long InterlockedExchange64(
long long volatile * Target,
long long Value);
long InterlockedExchangeAdd(
long volatile * Addend,
long Value);
short InterlockedExchangeAdd16(
short volatile * Addend,
short Value);
long long InterlockedExchangeAdd64(
long long volatile * Addend,
long long Value);
long InterlockedIncrement(
long volatile * Addend);
short InterlockedIncrement16(
short volatile * Addend);
long long InterlockedIncrement64(
long long volatile * Addend);
#define InterlockedExchangePointer(Target, Value) \
(PVOID)InterlockedExchange((LONG*)(Target), (LONG)(Value))
#define InterlockedCompareExchangePointer(Destination, ExChange, Comperand) \
(PVOID)InterlockedCompareExchange((LONG*)(Destination), (LONG)(ExChange), (LONG)(Comperand))
The variable pointed to by the Addend parameter must be aligned on a 64-bit boundary; otherwise, this function will behave unpredictably on multiprocessor x86 systems and any non-x86 systems.
The interlocked functions provide a simple mechanism for synchronizing access to a variable that is shared by multiple threads. This function is atomic with respect to calls to other interlocked functions.
This function generates a full memory barrier (or fence) to ensure that memory operations are completed in order.
| Versions | Defined in | Include | Link to |
|---|---|---|---|
| INtime 3.0 | intime/rt/include/rtbase.h | rt.h | rt.lib |
| intime/rt/include/intrin.h | rt.h | rt.lib |