_InterlockedExchangeAdd funzioni intrinseche

Sezione specifica Microsoft

Fornire il supporto intrinseco del compilatore per la funzione funzioni intrinseche win32 di Windows SDK _InterlockedExchangeAdd.

Sintassi

long _InterlockedExchangeAdd(
   long volatile * Addend,
   long Value
);
long _InterlockedExchangeAdd_acq(
   long volatile * Addend,
   long Value
);
long _InterlockedExchangeAdd_rel(
   long volatile * Addend,
   long Value
);
long _InterlockedExchangeAdd_nf(
   long volatile * Addend,
   long Value
);
long _InterlockedExchangeAdd_HLEAcquire(
   long volatile * Addend,
   long Value
);
long _InterlockedExchangeAdd_HLERelease(
   long volatile * Addend,
   long Value
);
char _InterlockedExchangeAdd8(
   char volatile * Addend,
   char Value
);
char _InterlockedExchangeAdd8_acq(
   char volatile * Addend,
   char Value
);
char _InterlockedExchangeAdd8_rel(
   char volatile * Addend,
   char Value
);
char _InterlockedExchangeAdd8_nf(
   char volatile * Addend,
   char Value
);
short _InterlockedExchangeAdd16(
   short volatile * Addend,
   short Value
);
short _InterlockedExchangeAdd16_acq(
   short volatile * Addend,
   short Value
);
short _InterlockedExchangeAdd16_rel(
   short volatile * Addend,
   short Value
);
short _InterlockedExchangeAdd16_nf(
   short volatile * Addend,
   short Value
);
__int64 _InterlockedExchangeAdd64(
   __int64 volatile * Addend,
   __int64 Value
);
__int64 _InterlockedExchangeAdd64_acq(
   __int64 volatile * Addend,
   __int64 Value
);
__int64 _InterlockedExchangeAdd64_rel(
   __int64 volatile * Addend,
   __int64 Value
);
__int64 _InterlockedExchangeAdd64_nf(
   __int64 volatile * Addend,
   __int64 Value
);
__int64 _InterlockedExchangeAdd64_HLEAcquire(
   __int64 volatile * Addend,
   __int64 Value
);
__int64 _InterlockedExchangeAdd64_HLERelease(
   __int64 volatile * Addend,
   __int64 Value
);

Parametri

Addendo
[in, out] Valore a cui aggiungere; sostituito dal risultato dell'addizione.

valore
[in] Valore da aggiungere.

Valore restituito

Il valore restituito è il valore iniziale della variabile a cui punta il parametro Addend.

Requisiti

Intrinsic Architettura Intestazione
_InterlockedExchangeAdd, _InterlockedExchangeAdd8, _InterlockedExchangeAdd16 x86, ARM, x64, ARM64 <intrin.h>
_InterlockedExchangeAdd64 ARM, x64, ARM64 <intrin.h>
_InterlockedExchangeAdd_acq, _InterlockedExchangeAdd_rel, , _InterlockedExchangeAdd8_acq, _InterlockedExchangeAdd8_rel_InterlockedExchangeAdd8_nf, ,_InterlockedExchangeAdd16_acq_InterlockedExchangeAdd16_rel , _InterlockedExchangeAdd16_nf_InterlockedExchangeAdd64_acq, , _InterlockedExchangeAdd64_rel_InterlockedExchangeAdd_nf_InterlockedExchangeAdd64_nf ARM, ARM64 <intrin.h>
_InterlockedExchangeAdd_HLEAcquire, _InterlockedExchangeAdd_HLERelease x86, x64 <immintrin.h>
_InterlockedExchangeAdd64_HLEAcquire, _InterlockedExchangeAdd64_HLErelease x64 <immintrin.h>

Osservazioni:

Ci sono diverse varianti di _InterlockedExchangeAdd che variano in base ai tipi di dati interessati e all'uso della semantica di acquisizione o di rilascio specifica del processore.

Mentre la funzione _InterlockedExchangeAdd opera su valori integer a 32 bit, _InterlockedExchangeAdd8 opera su valori integer a 8 bit, _InterlockedExchangeAdd16 opera su valori integer a 16 bit e _InterlockedExchangeAdd64 opera su valori integer a 64 bit.

Sulle piattaforme ARM usare le funzioni intrinseche con i suffissi _acq e _rel per la semantica di acquisizione e di rilascio, ad esempio all'inizio e alla fine di una sezione critica. I suffissi intrinseci con un _nf suffisso ("nessun recinto") non fungono da barriera di memoria.

Sulle piattaforme Intel che supportano le istruzioni HLE (Hardware Lock Elision), le funzioni intrinseche con suffissi _HLEAcquire e _HLERelease includono un hint per il processore che consente di accelerare le prestazioni eliminando un passaggio di blocco scrittura nell'hardware. Se queste funzioni intrinseche vengono chiamate su piattaforme che non supportano HLE, l'hint viene ignorato.

Queste routine sono disponibili solo come funzioni intrinseche. Sono intrinseci anche quando viene usato /Oi o #pragma intrinseco . Non è possibile usare #pragma funzione su questi intrinseci.

Esempio

Per un esempio di come usare _InterlockedExchangeAdd, vedere _InterlockedDecrement.

Fine sezione specifica Microsoft

Vedi anche

Intrinseci del compilatore
Parole chiave
Conflitti con il compilatore x86