- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
来自 c++11 29.3-p3:
There shall be a single total order S on all memory_order_seq_cst operations, consistent with the "happens before" order and modification orders for all affected locations, such that each memory_order_seq_cst operation B that loads a value from an atomic object M observes either one of the following values:
-- the result of the last modification A of M that precedes B in S, if it exists, or
-- if A exists, the result of some modification of M in the visible sequence of side effects with respect to B that is not memory_order_seq_cst and that does not happen before A, or
-- if A does not exist, the result of some modification of M in the visible sequence of side effects with respect to B that is not memory_order_seq_cst.
[ Note: Although it is not explicitly required that S include locks, it can always be extended to an order that does include lock and unlock operations, since the ordering between those is already included in the "happens before" ordering. --end note ]
在最后一个注释中,“始终”是什么意思?我可以理解任何特定的实现都可以设计为支持这样的扩展 S。但是在一些不是为此设计的通用实现中,我看不到 S 可以使用所描述的属性进行扩展。
这是否意味着这里也满足相同可见性属性的扩展顺序?
我已经把这个问题发给了 comp.std.c++ 但没有得到答案。 http://groups.google.com/group/comp.std.c++/browse_frm/thread/5242fa70d0594d1b#
最佳答案
What does it mean by "always"?
Always表示总存在一个订单S+l
在 seq_cst ops U lock ops
这与 happens-before
一致和 S
.
事实 1:S
是与HB
一致的总序.
事实 2:锁定操作在 HB
中排序部分顺序,因为它们是获取/释放操作。
事实 3:HB
中没有循环.
引理 1:S' = S union HB
中没有环.
证明:如果 S'
中有环, 它们的形式为 Aop1 <S Aop2 <HB Aop1
,因为任何两个原子操作在 S
中都是可比较的happens-before 是传递性的。这将与事实 1 相矛盾。QED
结论:因为对于每个偏序(=没有循环)存在其对全序的扩展(参见拓扑排序),所以有一个全序扩展S'
。 .所以你只需从中选择原子和锁定操作并得到 S+l
.
But in some general implementation that wasn't designed for it, I don't see that S can be extended so.
这样的实现不会满足 mem_order_seq_cst
要求。
关于c++11 原子排序 : extended total order memory_order_seq_cst for locks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10869322/
这段代码: interface I {} public class Test { TableView table; Test(ObservableList list) {
我们从 .NET 2.0 升级到 .NET 3.5。我的一位同事尝试在 Visual Studio 2008 中的调试器下运行 ASP .NET Web 项目时出现以下对话框。他可以正常构建,但无法调
我有一个具有class User extends Authenticatable的用户模型类,并且我也创建了另一个具有class Foo extends Model的模型类 这会在显示路线文件中的数据
我遇到的一个常见问题 @extend当试图用另一个 @extend 覆盖继承的属性时. 这是一个例子: // class selectors to be @extended // these coul
我对以下代码的 typescript 编译错误感到困惑: function f(x: T, y: S) { if (x === y) { // ERROR: This condition
这与对象 {} === {} 无关, found this issues不知道这个是不是一样 类型集 - AUnion 不是空集。另外两种类型(L 和R)正在扩展它。我的理解是这些 L、R 至少和 A
我收到以下错误: Extender Provider failed to return an Extender for this object 尝试为 .Net v4.7.2 加载 WCF 项目时。我
我收到以下错误: Extender Provider failed to return an Extender for this object 尝试为 .Net v4.7.2 加载 WCF 项目时。我
我刚刚在读Javascript: Module Pattern vs Constructor/Prototype pattern?我很好奇,当我们使用 $.fn.extend 或 $.extend 扩
我正在用 extend 做一些测试,在我做了一些观察后我有点困惑。初步观察: console.log($.extend === $.fn.extend); // trure // and since
我一直在使用一些通用方法从元素的可变参数创建集合,例如 public Set createSet( T... elements ) { ... 然而,最近我遇到了编译器没有按照我的预期去做的情况。以
刚去面试,问了一个问题。 面试官 - Java 是否支持多重继承? 我 - 不 面试官 - Java 中的每个类都扩展了类 Object(类 Object 除外),如果我们从外部扩展一个类,例如 Cl
我目前正在实现我的第一个 GWT 应用程序,我只是有一个快速的问题,关于在创建复杂的自定义小部件时 Extends Composite 和 Extend a specified widget 之间的区
使用 Observable 扩展 Object 和应用于以下类的扩展 Observable 之间有什么区别。 当应用程序运行时,结果是一样的。 library models; import 'pack
我制作了一个类装饰器,我想限制这个装饰器只能应用于某些类,所以我这样做了: @decorator() class A { foo:string; } @decorator() class B
在这个例子中: import java.util.*; public class Example { static void doesntCompile(Map> map) {} st
注意:这个问题与 Enum 无关,所以它不是重复的。Enum 被迫只与自身比较,因为编译器生成类型参数,而不是因为 java 递归类型参数。 我试图找到将类声明为的优势: public class S
我是 Java 的新手,正在尝试从 Java 泛型和集合一书中理解以下奇怪的语法。(我广泛使用 C++ 模板,因此可以声称了解泛型编程的基础知识和可能的陷阱): interface Collect
注意:这个问题与 Enum 无关,所以它不是重复的。Enum 被迫只与自身比较,因为编译器生成类型参数,而不是因为 java 递归类型参数。 我试图找到将类声明为的优势: public class S
有人知道是否可以延长 child Blade 吗? 我的应用程序有一个通用的布局模板,然后每个页面都从该模板@extends。每个页面都可以根据需要为其他 HTML block (例如模态)引入一系列
我是一名优秀的程序员,十分优秀!