atomic_compare_exchange_weak, atomic_compare_exchange_strong, atomic_compare_exchange_weak_explicit, atomic_compare_exchange_strong_explicit
De cppreference.com.
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Défini dans l'entête <stdatomic.h>
|
||
| _Bool atomic_compare_exchange_strong( volatile A* obj, C* expected, C desired ); |
(1) | (depuis C11) |
| _Bool atomic_compare_exchange_weak( volatile A *obj, C* expected, C desired ); |
(2) | (depuis C11) |
| _Bool atomic_compare_exchange_strong_explicit( volatile A* obj, C* expected, C desired, |
(3) | (depuis C11) |
| _Bool atomic_compare_exchange_weak_explicit( volatile A *obj, C* expected, C desired, |
(4) | (depuis C11) |
Compare atomiquement la valeur pointée par
obj avec la valeur pointée par expected, et si ceux-ci sont égaux, remplace l'ancien desired (effectue lecture-modification-écriture). Dans le cas contraire, la valeur réelle charge pointée par obj en *expected (effectue une opération de charge) .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.
You can help to correct and verify the translation. Click here for instructions.
Les modèles de la mémoire pour la lecture-modification-écriture et les opérations de chargement et sont
succ fail respectivement. Les versions (1-2) memory_order_seq_cst utiliser par défaut .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.
You can help to correct and verify the translation. Click here for instructions.
Les formes faibles ((1) et (3)) des fonctions sont autorisés à ne pas faussement, qui est, comme si *obj != *expected même si elles sont égales. Quand une comparaison et d'échange est dans une boucle, la version faible donnera de meilleures performances sur certaines plates-formes. Quand un faible compare-and-échange, il faudrait une boucle et une forte ne serait pas, le fort est préférable .
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.
You can help to correct and verify the translation. Click here for instructions.
Il s'agit d'une fonction générique définis pour tous les types d'objets atomiques.
A est le type d'un objet atomique, C est du type non-atomique correspondant à A .Original:
This is a fonction générique 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.
You can help to correct and verify the translation. Click here for instructions.
[modifier] Paramètres
| obj | - | pointeur vers l'objet atomique pour tester et modifier
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 | - | pointeur à la valeur prévue pour être trouvé dans l'objet atomique
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 | - | la valeur à stocker dans l'objet atomique si elle est conforme aux attentes
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 synchronisation de la mémoire de commande de lecture-modification-écriture, si la comparaison aboutit. Toutes les valeurs sont permises .
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 synchronisation de mémoire de commande pour l'opération de chargement si la comparaison échoue. Ne peut pas être memory_order_release ou memory_order_ack_rel et ne pouvez pas spécifier plus forte que
succ ordreOriginal: 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 succThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifier] Retourne la valeur
Le résultat de la comparaison: si true
*obj était égal à *exp, false autrement .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.
You can help to correct and verify the translation. Click here for instructions.
[modifier] Voir aussi
| swaps d'une valeur avec la valeur d'un objet atomique 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. (fonction) | |
| C++ documentation for atomic_compare_exchange_weak, atomic_compare_exchange_strong, atomic_compare_exchange_weak_explicit, atomic_compare_exchange_strong_explicit
| |