P0668R4 对此进行了解释
The definition of plain happens-before became unpleasantly complicated with the introduction of memory_order_consume
. And it is not transitive, which remains counterintuitive. This proposal changes neither of those. And if the user refrains from using memory_order_consume
it can continue to be entirely ignored, as before. Until we have a usable version of memory_order_consume
, I would expect teaching materials to ignore these issues, and pretend that happens-befors is defined as our simply-happens-before relation, which is clearly transitive. In the presence of memory_order_consume
, this problem is unavoidable, since consume can order two accesses without also ordering the first with respect to an access that immediately follows the second; happens-before cannot compose with sequenced-before, and thus happens-before cannot be transitive.
在不使用 memory_order_consume
的情况下,happens-before 可以视为可传递,否则为不可传递。C++17 提出了 strongly happens before
,排除了 memory_order_consume
,是可传递的,可以和 sequenced-before 进行组合。
原文链接: https://www.cnblogs.com/mkckr0/p/15717917.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍;
也有高质量的技术群,里面有嵌入式、搜广推等BAT大佬
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/381507
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!