Namespace
Varianti

atomic_compare_exchange_weak, atomic_compare_exchange_strong, atomic_compare_exchange_weak_explicit, atomic_compare_exchange_strong_explicit

Da cppreference.com.
< c‎ | atomic

 
 
Atomic operazioni di biblioteca
Tipi
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
memory_order
atomic_flag
Macro
Original:
Macros
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ATOMIC_***_LOCK_FREE
ATOMIC_FLAG_INIT
ATOMIC_VAR_INIT
kill_dependency
Funzioni
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
atomic_flag_test_and_set
atomic_flag_clear
atomic_init
atomic_is_lock_free
atomic_store
atomic_load
atomic_exchange
atomic_compare_exchange
atomic_fetch_add
atomic_fetch_sub
atomic_fetch_or
atomic_fetch_xor
atomic_fetch_and
atomic_thread_fence
atomic_signal_fence
 
Defined in header <stdatomic.h>
_Bool atomic_compare_exchange_strong( volatile A* obj,
                                      C* expected, C desired );
(1)
_Bool atomic_compare_exchange_weak( volatile A *obj,
                                    C* expected, C desired );
(2)
_Bool atomic_compare_exchange_strong_explicit( volatile A* obj,

                                               C* expected, C desired,
                                               memory_order succ,

                                               memory_order fail );
(3)
_Bool atomic_compare_exchange_weak_explicit( volatile A *obj,

                                             C* expected, C desired,
                                             memory_order succ,

                                             memory_order fail );
(4)
Confronta atomico il valore puntato da obj con il valore puntato da expected, e se quelli sono uguali, sostituisce la precedente con desired (esegue lettura-modifica-scrittura). In caso contrario, carica il valore reale puntato da obj in *expected (esegue l'operazione di carico).
Original:
Atomically compares the value pointed to by obj with the value pointed to by expected, and if those are equal, replaces the former with desired (performs read-modify-write operation). Otherwise, loads the actual value pointed to by obj into *expected (performs load operation).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
I modelli di memoria per la lettura-modifica-scrittura e le operazioni di carico sono succ e fail rispettivamente. I (1-2) versioni utilizzano memory_order_seq_cst di default.
Original:
The memory models for the read-modify-write and load operations are succ and fail respectively. The (1-2) versions use memory_order_seq_cst by default.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Le forme deboli ((1) e (3)) delle funzioni possono fallire spurio, che è, agire come se *obj != *expected anche se sono uguali. Quando un confronto e di scambio è in un ciclo, la versione debole produrrà migliori prestazioni su alcune piattaforme. Quando un debole confronto e scambio richiederebbe un ciclo e uno forte non, il forte è preferibile.
Original:
The weak forms ((1) and (3)) of the functions are allowed to fail spuriously, that is, act as if *obj != *expected even if they are equal. When a compare-and-exchange is in a loop, the weak version will yield better performance on some platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the strong one is preferable.
The text has been machine-translated via Google Translate.
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 oggetti atomici, C è il non-atomico tipo corrispondente al A.
Original:
This is a funzione generica defined for all atomic object types. A is the type of an atomic object, C is the non-atomic type corresponding to A.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Parametri

obj -
puntatore all'oggetto atomica per testare e modificare
Original:
pointer to the atomic object to test and modify
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
expected -
puntatore al valore atteso per essere trovato in oggetto atomico
Original:
pointer to the value expected to be found 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.
desired -
il valore da memorizzare nell'oggetto atomico se è come previsto
Original:
the value to store in the atomic object if it is as expected
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
succ -
la sincronizzazione memoria ordinamento per la lettura-modifica-scrittura, se il confronto ha esito positivo. Tutti i valori sono consentiti .
Original:
the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. 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.
fail -
la sincronizzazione della memoria di ordinazione per l'operazione di caricamento, se il paragone non regge. Non può essere memory_order_release o memory_order_ack_rel e non può specificare più forte ordine di succ
Original:
the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_ack_rel and cannot specify stronger ordering than succ
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 risultato del confronto: se true *obj è stato pari a *exp, false altrimenti.
Original:
The result of the comparison: true if *obj was equal to *exp, false otherwise.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Vedi anche

swap un valore con il valore di un oggetto atomico
Original:
swaps a value with the value of an atomic object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(funzione) [edit]
C++ documentation for atomic_compare_exchange_weak, atomic_compare_exchange_strong, atomic_compare_exchange_weak_explicit, atomic_compare_exchange_strong_explicit