atomic_compare_exchange_weak, atomic_compare_exchange_strong, atomic_compare_exchange_weak_explicit, atomic_compare_exchange_strong_explicit
Aus 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. |
<metanoindex/>
<tbody> </tbody>| definiert 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) | |
Atomar vergleicht den Wert, auf den durch
obj mit dem Wert, auf den durch expected, und wenn diese gleich sind, ersetzt die früheren mit desired (durchführt Lese-Modifizieren-Schreib-Operation). Andernfalls lädt den aktuellen Wert, auf den obj in *expected (führt im Leerlauf) .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.
Die Speichermodule Modelle für die Lese-Modifizieren-Schreiben und Ladeoperationen sind
succ und fail sind. Die (1-2)-Versionen verwenden memory_order_seq_cst standardmäßig .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.
Die schwachen Formen ((1) und (3)) der Funktionen dürfen spuriously scheitern, das ist, als ob
*obj != *expected handeln, auch wenn sie gleich sind. Wenn ein Vergleichs-und Austausch in einer Schleife ist, wird die schwache Version eine bessere Leistung auf einigen Plattformen. Wenn ein schwacher Vergleichen und-Austausch würde eine Schleife und eine starke eins erfordern würde nicht, ist der Starke vorzuziehen .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.
Dies ist ein für alle atomaren generische Funktion Objekttypen definiert.
A ist der Typ eines atomaren Objekt, ist das nicht-C Atomtyp entsprechend A .Original:
This is a generische Funktion 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.
Parameter
| obj | - | Zeiger auf die atomare Objekt zu testen und zu modifizieren
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 | - | Zeiger auf den Wert soll im atomaren Objekt gefunden werden
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 | - | der Wert in der atomaren Objekt zu speichern, wenn es wie erwartet
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 | - | der Speicher Synchronisation Bestellsystem für die Lese-Modifizieren-Schreib-Operation, wenn der Vergleich erfolgreich ist. Alle Werte sind zulässig .
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 | - | der Speicher Synchronisation Bestellsystem für die Ladeoperation, wenn der Vergleich fehlschlägt. Kann nicht sein
memory_order_release oder memory_order_ack_rel und können nicht angeben, stärker Bestellung als succOriginal: 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. |
Rückgabewert
Das Ergebnis des Vergleichs:
true wenn *obj gleich *exp war, ansonsten false .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.
Siehe auch
Swaps ein Wert mit dem Wert eines atomaren Objekt 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. (Funktion) | |
C++ documentation for atomic_compare_exchange_weak, atomic_compare_exchange_strong, atomic_compare_exchange_weak_explicit, atomic_compare_exchange_strong_explicit
| |