atomic_fetch_add, atomic_fetch_add_explicit
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Defined in header <stdatomic.h>
|
||
C atomic_fetch_add( volatile A* obj, M arg ); |
(1) | |
C atomic_fetch_add_explicit( volatile A* obj, M arg, memory_order order ); |
(2) | |
Sostituisce atomicamente il valore rilevato dal
obj
con il risultato di aggiunta di arg
al vecchio valore di obj
, e restituisce il valore obj
svolto precedentemente. L'operazione è lettura-modifica-scrittura. La prima memoria versione ordini accessi secondo memory_order_seq_cst, la seconda memoria versione ordini accessi secondo order
.Original:
Atomically replaces the value pointed by
obj
with the result of addition of arg
to the old value of obj
, and returns the value obj
held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Questo è un funzione generica definita per ogni tipologia di oggetto atomici.
A
è il tipo di un oggetto atomico, M
può essere il non-atomica tipo corrispondente al A
se A
è atomico tipo intero, o se ptrdiff_t A
è di tipo puntatore atomica.Original:
This is a funzione generica defined for all atomic object types.
A
is the type of an atomic object, M
is either the non-atomic type corresponding to A
if A
is atomic integer type, or ptrdiff_t if A
is atomic pointer type.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Per firmati tipi interi, aritmetica è definito l'utilizzo di due rappresentazione in complemento. Ecco
Original:
For signed integer types, arithmetic is defined to use two’s complement representation. There
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
sono risultati non definiti. Per i tipi di puntatore, il risultato può essere un indirizzo definito, ma le operazioni altrimenti non hanno un comportamento indefinito.
Original:
are no undefined results. For pointer types, the result may be an undefined address, but the operations otherwise have no undefined behavior.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Parametri
obj | - | puntatore all'oggetto atomica da modificare
Original: pointer to the atomic object to modify The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
arg | - | il valore da aggiungere al valore memorizzato nell'oggetto atomica
Original: the value to add to the value stored in the atomic object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
order | - | la sincronizzazione della memoria di ordinazione per questa operazione: tutti i valori sono consentiti
Original: the memory synchronization ordering for this operation: all values are permitted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica] Valore di ritorno
Il valore tiene già essere oggetto atomico puntato da
obj
.Original:
The value held previously be the atomic object pointed to by
obj
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Vedi anche
atomica sottrazione Original: atomic subtraction The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) | |
C++ documentation for atomic_fetch_add, atomic_fetch_add_explicit
|