std::atomic_compare_exchange_weak, std::atomic_compare_exchange_strong, std::atomic_compare_exchange_weak_explicit, std::atomic_compare_exchange_strong_explicit
![]() | 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. |
Elemento definito nell'header <atomic> | ||
template<class T > bool atomic_compare_exchange_weak(std::atomic<T>* obj, | (1) | (dal C++11) |
template<class T > bool atomic_compare_exchange_strong(std::atomic<T>* obj, | (2) | (dal C++11) |
template<class T > bool atomic_compare_exchange_weak_explicit(std::atomic<T>* obj, | (3) | (dal C++11) |
template<class T > bool atomic_compare_exchange_strong_explicit(std::atomic<T>* obj, | (4) | (dal C++11) |
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).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).You can help to correct and verify the translation. Click here for instructions.
succ
e fail
rispettivamente. I (1-2) versioni utilizzano std::memory_order_seq_cst di default.succ
and fail
respectively. The (1-2) versions use std::memory_order_seq_cst by default.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.
You can help to correct and verify the translation. Click here for instructions.
Indice |
[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 memoria sycnhronization ordinamento per la lettura-modifica-scrittura, se il confronto ha esito positivo. Tutti i valori sono consentiti . Original: the memory sycnhronization 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 | - | sycnhronization la memoria di ordinazione per l'operazione di caricamento, se il paragone non regge. Non può essere std::memory_order_release o std::memory_order_ack_rel e non può specificare più forte ordine di succ Original: the memory sycnhronization ordering for the load operation if the comparison fails. Cannot be std::memory_order_release or std::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
*obj
è stato pari a *exp
, false altrimenti.*obj
was equal to *exp
, false otherwise.You can help to correct and verify the translation. Click here for instructions.
[modifica]Eccezioni
[modifica]Esempio
You can help to correct and verify the translation. Click here for instructions.
void append(list* s, node* n){ node* head;do{ head = s->head; n->next = head;}while(! std::atomic_compare_exchange_weak(s->head, head, n));}
[modifica]Vedi anche
confronta atomicamente il valore dell'oggetto atomica con non-atomica argomento ed esegue lo scambio atomico se il carico uguale o atomico in caso contrario Original: atomically compares the value of the atomic object with non-atomic argument and performs atomic exchange if equal or atomic load if not The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
(C++11) (C++11) | sostituisce atomicamente il valore dell'oggetto atomica con non-atomica argomento e restituisce il vecchio valore del atomica Original: atomically replaces the value of the atomic object with non-atomic argument and returns the old value of the atomic The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione di modello) |
specializzata operazioni atomiche per std :: shared_ptr Original: specializes atomic operations for std::shared_ptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione di modello) | |
C documentation for atomic_compare_exchange, atomic_compare_exchange_explicit |