
c++20 规范 的 atomic 头文件的阅读注释
c++20 规范 的 《 atomic 》 头文件的阅读注释, 在 v s 2 019
zhangzhangkeji
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
atomic 注释32:测试显示 atomic<T> 原子量也可以用于逻辑的条件判断,
(88) :++ :++。(89)原创 2025-02-24 04:16:55 · 186 阅读 · 0 评论 -
atomic 注释31:丰富了 atomic<bool> 功能的 原子标志类 atomic_flag 及其源码,本 < atomic > 头文件的源代码汇总并附上可下载的头文件
(86) 丰富了 atomic《bool》 功能的 原子标志类 atomic_flag 及其源码 :++ 给出其源码:struct atomic_flag // flag with test-and-set semantics 带有测试和设置语义的标志{ atomic<long> _Storage; // 本类的数据成员,存储 0 表 false, 1 表 true constexpr atomic_flag() noexcept = default; // 默原创 2024-12-29 08:13:53 · 951 阅读 · 0 评论 -
atomic 注释30:类 atomic_ref<T>的成员函数 compare_exchange_strong () 及 compare_exchange_weak ()及该模板类的源代码
而 atomic 的数据成员则是 atomic 中独有的,与别的变量没有联系。这俩模板类适用于不同的场景。前者的源码,在 c++20 规范里,大师们才给出了定义。原创 2024-12-29 07:21:33 · 271 阅读 · 0 评论 -
atomic 注释29:函 __std_atomic_has_cmpxchg16b ( ), atomic_ref<T>的成员函数 exchange () 返回旧值
(82)(83)(84)原创 2024-12-28 10:44:27 · 129 阅读 · 0 评论 -
atomic 注释28:测试 atomic<T>的成员函数 compare_exchange_weak()比较及弱交换, 及 atomic<T>的完整源代码,atomic<T> 中 T 不可为引用类型
(79)(80)(81)原创 2024-12-28 06:10:15 · 178 阅读 · 0 评论 -
atomic 注释27:测试模板类 atomic<T> 的成员函数 exchange (),比较及强交换 compare_exchange_strong ()
(77)(78)(79)原创 2024-12-28 05:43:34 · 154 阅读 · 0 评论 -
atomic 注释26:测试模板类 atomic<T> 的成员函数 is_lock_free ()、load ()、类型转换函数 operator T ()、睡眠等待 wait ()
(72)(73)(74)原创 2024-12-27 09:27:10 · 133 阅读 · 0 评论 -
atomic 注释25:atomic<T>的父类 _Choose_atomic_base_t<T,T>或 _Choose_atomic_base2_t<T,T>及 atomic<T> 的继承关系总图
(67)(68)原创 2024-12-27 02:45:07 · 106 阅读 · 0 评论 -
atomic 注释24:爷模板类 _Atomic_storage<T,size_t> 的指针爹类 _Atomic_pointer<T>、 _Atomic_pointer< T& >及其成员函数测试
(65)(66)(67)原创 2024-12-26 23:28:18 · 114 阅读 · 0 评论 -
atomic 注释23:爷模板类 _Atomic_storage<T,size_t> 的浮点爹类 _Atomic_floating<T>、 _Atomic_floating< T& >及其成员函数测试
(63)(64)原创 2024-12-26 06:35:04 · 101 阅读 · 0 评论 -
atomic 注释22:爷模板类 _Atomic_storage<T,size_t> 的孙子类 _Atomic_integral_facade<T&>这个特化版本及其成员函数的测试结果
【代码】atomic 注释22:爷模板类 _Atomic_storage<T,size_t> 的孙子类 _Atomic_integral_facade<T&>这个特化版本及其成员函数的测试结果。原创 2024-12-26 06:34:12 · 335 阅读 · 0 评论 -
atomic 注释21:爷模板类 _Atomic_storage<T,size_t> 的孙子类 _Atomic_integral_facade<T>的泛化版本及其成员函数的测试结果
(59)(60)(61)原创 2024-12-26 05:23:47 · 132 阅读 · 0 评论 -
atomic 注释20:类 make_unsigned_t<T> 是获取数据类型 T 的无符号版本,测试成员函数 _Atomic_integral_facade<int>::_Negate(4)
(57)(58)(59)原创 2024-12-26 00:46:57 · 143 阅读 · 0 评论 -
atomic 注释19:特化版本 _Atomic_integral<T , 2>,源代码纠错,类 _Atomic_integral<T , 4>,类 _Atomic_integral<T , 8>
如图,源代码不报错,估计又是条件编译,又是类型推断,导致编译器不再报错。原创 2024-12-26 00:44:03 · 341 阅读 · 0 评论 -
atomic 注释18:模板类 _Atomic_integral<T, u_long_long> 及其特化版本 _Atomic_integral<_Ty, 1>
该系列模板类在 _Atomic_storage<_Ty> 的基础上增加了对数据的原子运算,加减法,逻辑与或运算等。原创 2024-12-25 18:16:26 · 319 阅读 · 0 评论 -
atomic 注释17:wins 平台的系统函数 _InterlockedAnd8 (),_InterlockedOr8 (),_InterlockedXor8 ()
(49),(50) ** 函数 _InterlockedOr8 ()** :(51)原创 2024-12-25 17:50:22 · 195 阅读 · 0 评论 -
atomic 注释16:特化模板类 _Atomic_storage<_Ty&, 16>,wins 平台系统函数 _InterlockedExchangeAdd8 (),
(47)(48)(49)原创 2024-12-25 01:06:55 · 393 阅读 · 0 评论 -
atomic 注释15:特化模板类 _Atomic_storage<T, 2>、_Atomic_storage<T, 4>、_Atomic_storage<T, 8>
(44)(45)原创 2024-12-24 22:02:30 · 117 阅读 · 0 评论 -
atomic 注释14:类 _Atomic_lock_guard<T>,泛型类 _Atomic_storage<T , u_long_long >及特化版本 _Atomic_storage<T ,1>
(38)(39)(40)原创 2024-12-24 04:28:37 · 110 阅读 · 0 评论 -
atomic 注释13:函 _Atomic_wait_compare_non_lock_free (), _Atomic_wait_compare_16_bytes () 与指令 CMPXCHG16B
【代码】atomic 注释13:函 _Atomic_wait_compare_non_lock_free (), _Atomic_wait_compare_16_bytes () 与指令 CMPXCHG16B。原创 2024-12-23 22:17:26 · 240 阅读 · 0 评论 -
atomic 注释12:函 __iso_volatile_load32 (),_mm_pause (),_Atomic_lock_acquire (),_Atomic_lock_release ()
(32)(33)原创 2024-12-23 02:54:58 · 211 阅读 · 0 评论 -
<atomic> 注释11:wins 平台函数 _InterlockedIncrement ()、_InterlockedDecrement ()
(31)**wins 平台函数 _InterlockedIncrement ( ) 与 _InterlockedDecrement () ** , 虽然目前,在 《atomic》头文件里还没有出现,也一并学习了。原创 2024-12-23 02:53:54 · 241 阅读 · 0 评论 -
<atomic> 注释10:wins平台函 _InterlockedExchange64 ()、_InterlockedCompareExchange () 及其 64 位版本
(29)(30)(31)(32)原创 2024-12-23 01:51:57 · 369 阅读 · 0 评论 -
<atomic> 注释9:win 平台函数 WakeByAddressSingle () 与 WakeByAddressAll (),wins 平台函 _InterlockedExchange ( )
【代码】<atomic> 注释9:win 平台函数 WakeByAddressSingle () 与 WakeByAddressAll (),原创 2024-12-22 18:46:54 · 174 阅读 · 0 评论 -
<atomic> 注释8:类 _Atomic_padded<T>,_Atomic_storage_types<T>,函 _Atomic_wait_direct (),WaitOnAddress ( )
(22),该类就是可以存储一个数据:++ 测试一下:(23)(24)(25)原创 2024-12-22 16:35:06 · 256 阅读 · 0 评论 -
<atomic> 注释7:函 _Combine_cas_memory_orders (),_Atomic_reinterpret_as (),_Load_barrier ()
该函数似乎是为了给交换和比较操作指定一个合适的内存约束级别。原创 2024-12-21 23:43:53 · 227 阅读 · 0 评论 -
<atomic> 注释6:函 _Check_memory_order (),_Check_store_memory_order () 与 _Check_load_memory_order ()
(17) ,当前的内存序只有这几种,不属于当前范围的就报错,此函数会给一个报错,并终止进程:++ 测试:(18)(19)原创 2024-12-21 23:05:22 · 217 阅读 · 0 评论 -
<atomic> 注释5:函 atomic_thread_fence (),atomic_signal_fence (),kill_dependency<T> (),
(14)(15)(16)原创 2024-12-21 17:23:31 · 190 阅读 · 0 评论 -
<atomic> 注释4:memory_order_consume 获取-释放序(已被弃用),memory_order_seq_cst 最严格,枚举类内存序 memory_order
【代码】<atomic> 注释4:memory_order_consume 获取-释放序(已被弃用),memory_order_seq_cst 最严格,原创 2024-12-21 15:22:44 · 274 阅读 · 0 评论 -
<atomic> 注释3:memory_order_release发布,memory_order_acquire 接收,memory_order_acq_rel发送与接收
(8)(9)(10)原创 2024-12-21 14:03:51 · 217 阅读 · 0 评论 -
vs2019 c++20规范 STL 库中头文件 <atomic> 源码注释及探讨几个知识点
(2 探讨二 ) 可见 atomic 的 fetch_xx 函数,返回的都是 atomic 中存储的旧值。原创 2024-06-13 19:27:09 · 462 阅读 · 0 评论 -
<atomic> 注释2:#if 的参数形式,类 _Storage_for<T>,编译抑制 #pragma warning(suppress : 5),内存约束memory_order_relaxed
(4)(5)(6)原创 2024-12-21 00:49:36 · 102 阅读 · 0 评论