You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -272,7 +274,7 @@ This is a very strong set of synchronization conditions, in other words when it
272
274
This seems too harsh for a variable that requires only atomic operations (no intermediate state).
273
275
274
276
The research on synchronization conditions has a very long history, and we will not go into details here. Readers should understand that under the modern CPU architecture, atomic operations at the CPU instruction level are provided.
275
-
Therefore, in the C++11 multi-threaded shared variable reading and writing, the introduction of the `std::atomic` template, so that we instantiate an atomic type, will be a
277
+
Therefore, in the C++11 multi-threaded shared variable reading and writing, the introduction of the `std::atomic` template, so that we instantiate an atomic type, will be an
276
278
Atomic type read and write operations are minimized from a set of instructions to a single CPU instruction. E.g:
277
279
278
280
```cpp
@@ -417,8 +419,11 @@ Weakening the synchronization conditions between processes, usually we will cons
417
419
```
418
420
3 4 4 4 // The write operation of x was quickly observed
419
421
0 3 3 4 // There is a delay in the observed time of the x write operation
420
-
0 0 0 4 // The last read read the final value of x, but the previous changes were not observed.
421
-
0 0 0 0 // The write operation of x is not observed in the current time period, but the situation that x is 4 can be observed at some point in the future.
422
+
0 0 0 4 // The last read read the final value of x,
423
+
// but the previous changes were not observed.
424
+
0 0 0 0 // The write operation of x is not observed in the current time period,
425
+
// but the situation that x is 4 can be observed
426
+
// at some point in the future.
422
427
```
423
428
424
429
### Memory Orders
@@ -480,9 +485,8 @@ To achieve the ultimate performance and achieve consistency of various strength
480
485
});
481
486
std::thread acqrel([&]() {
482
487
int expected = 1; // must before compare_exchange_strong
0 commit comments