Skip to content

Commit c172682

Browse files
authored
book: fix typo (changkun#215)
1 parent 19ceeb7 commit c172682

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

book/en-us/07-thread.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ int main() {
322322
}
323323
```
324324
325-
### Concistency Model
325+
### Consistency Model
326326
327327
Multiple threads executing in parallel, discussed at some macro level, can be roughly considered a distributed system.
328328
In a distributed system, any communication or even local operation takes a certain amount of time, and even unreliable communication occurs.
@@ -366,7 +366,7 @@ Weakening the synchronization conditions between processes, usually we will cons
366366
x.store(2)
367367
```
368368
369-
Under the order consistency requirement, `x.load()` must read the last written data, so `x.store(2)` and `x.store(1)` do not have any guarantees, ie As long as `x.store(2)` of `T2` occurs before `x.store(3)`.
369+
Under the order consistency requirement, `x.load()` must read the last written data, so `x.store(2)` and `x.store(1)` do not have any guarantees, as long as `x.store(2)` of `T2` occurs before `x.store(3)`.
370370
371371
3. Causal consistency: its requirements are further reduced, only the sequence of causal operations is guaranteed, and the order of non-causal operations is not required.
372372
@@ -440,7 +440,7 @@ To achieve the ultimate performance and achieve consistency of various strength
440440
std::cout << "current counter:" << counter << std::endl;
441441
```
442442

443-
2. Release/consumption model: In this model, we begin to limit the order of operations between processes. If a thread needs to modify a value, but another thread will have a dependency on that operation of the value, that is, the latter depends. former. Specifically, thread A has completed three writes to `x`, and thread `B` relies only on the third `x` write operation, regardless of the first two write behaviors of `x`, then `A ` When active `x.release()` (ie using `std::memory_order_release`), the option `std::memory_order_consume` ensures that `B` observes `A` when calling `x.load()` Three writes to `x`. Let's look at an example:
443+
2. Release/consumption model: In this model, we begin to limit the order of operations between processes. If a thread needs to modify a value, but another thread will have a dependency on that operation of the value, that is, the latter depends on the former. Specifically, thread A has completed three writes to `x`, and thread `B` relies only on the third `x` write operation, regardless of the first two write behaviors of `x`, then `A ` When active `x.release()` (ie using `std::memory_order_release`), the option `std::memory_order_consume` ensures that `B` observes `A` when calling `x.load()` Three writes to `x`. Let's look at an example:
444444

445445
```cpp
446446
// initialize as nullptr to prevent consumer load a dangling pointer

0 commit comments

Comments
 (0)