Skip to content

Commit

Permalink
fix post: cpp concurrency programming note (#3)
Browse files Browse the repository at this point in the history
* Update 2023-12-25-cpp-concurrency.md

* add author
  • Loading branch information
Serein207 committed Dec 26, 2023
1 parent e92a8c0 commit 290a405
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 7 additions & 1 deletion blog/.authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ authors:
avatar: https://aliyun.sastimg.mxte.cc/images/2023/12/17/QQ20220819164336a533d1c9c523e00b.th.jpg
slug: url # Author profile slug
url: https://wiki.sast.fun # Author website URL
Serein:
name: Serein
description: SASTer
avatar: https://avatars.githubusercontent.com/u/118594118
slug: url # Author profile slug
url: https://wiki.sast.fun # Author website URL
NONE:
name: 匿名
description: SASTer
avatar: https://aliyun.sastimg.mxte.cc/images/2023/12/17/QQ20220819164336a533d1c9c523e00b.th.jpg
slug: url # Author profile slug
url: https://wiki.sast.fun # Author website URL
url: https://wiki.sast.fun # Author website URL
7 changes: 2 additions & 5 deletions blog/posts/2023-12-25-cpp-concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ categories:
tags:
- C++
authors:
squidfunk:
name: Serein
description: SASTer
avatar: https://avatars.githubusercontent.com/u/118594118
- Serein
---

## 内存模型基础
Expand Down Expand Up @@ -509,4 +506,4 @@ void func(int *data) {

由于`读寄存器地址1``写flag,标记中断处理完成`这两者之间的关系是读写关系。并不能被`std::memory_order_release`约束。所以需要更强的约束来处理。

这里可以使用`std::memory_order_acq_rel`,即对本条语句的读写进行约束。即表示写不后,读不前同时生效。 那么就可以保证`a, b, c`三个操作不会乱序。即`std::memory_order_acq_rel`可以同时表示 **写不后 && 读不前**
这里可以使用`std::memory_order_acq_rel`,即对本条语句的读写进行约束。即表示写不后,读不前同时生效。 那么就可以保证`a, b, c`三个操作不会乱序。即`std::memory_order_acq_rel`可以同时表示 **写不后 && 读不前**

0 comments on commit 290a405

Please sign in to comment.