MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
atomic< T * > 模板结构体 参考

指针类型的原子特化 更多...

#include <atomic.hpp>

类 atomic< T * > 继承关系图:
[图例]

Public 类型

using value_type
 值类型
Public 类型 继承自 atomic_base< T * >
using value_type = T*
 指针类型
using difference_type = ptrdiff_t
 差值类型

Public 成员函数

 operator T () const noexcept
 类型转换运算符
bool is_lock_free () const noexcept
 检查是否支持无锁操作
void store (T value, const memory_order mo=memory_order_seq_cst) noexcept
 原子存储操作
load (const memory_order mo=memory_order_seq_cst) const noexcept
 原子加载操作
exchange (T value, const memory_order mo=memory_order_seq_cst) noexcept
 原子交换操作
bool compare_exchange_weak (T &expected, T desired, const memory_order success, const memory_order failure) noexcept
 弱比较交换操作
bool compare_exchange_strong (T &expected, T desired, const memory_order success, const memory_order failure) noexcept
 强比较交换操作
Public 成员函数 继承自 atomic_base< T * >
constexpr atomic_base (const value_type ptr) noexcept
 构造函数
 operator value_type () const noexcept
 类型转换运算符
 operator value_type () const volatile noexcept
 volatile版本的类型转换运算符
value_type operator= (const value_type ptr) noexcept
 赋值运算符
value_type operator= (const value_type ptr) volatile noexcept
 volatile版本的赋值运算符
value_type operator++ (int) noexcept
 后置递增运算符
value_type operator++ (int) volatile noexcept
 volatile版本的后置递增运算符
value_type operator-- (int) noexcept
 后置递减运算符
value_type operator-- (int) volatile noexcept
 volatile版本的后置递减运算符
value_type operator++ () noexcept
 前置递增运算符
value_type operator++ () volatile noexcept
 volatile版本的前置递增运算符
value_type operator-- () noexcept
 前置递减运算符
value_type operator-- () volatile noexcept
 volatile版本的前置递减运算符
value_type operator+= (const ptrdiff_t dest) noexcept
 指针加法赋值运算符
value_type operator+= (const ptrdiff_t dest) volatile noexcept
 volatile版本的指针加法赋值运算符
value_type operator-= (const ptrdiff_t dest) noexcept
 指针减法赋值运算符
value_type operator-= (const ptrdiff_t dest) volatile noexcept
 volatile版本的指针减法赋值运算符
bool is_lock_free () const noexcept
 检查是否支持无锁操作
bool is_lock_free () const volatile noexcept
 volatile版本的检查是否支持无锁操作
MSTL_ALWAYS_INLINE void store (const value_type ptr, const memory_order mo=memory_order_seq_cst) noexcept
 原子存储指针操作
MSTL_ALWAYS_INLINE_INLINE void store (const value_type ptr, const memory_order mo=memory_order_seq_cst) volatile noexcept
 volatile版本的原子存储指针操作
MSTL_ALWAYS_INLINE value_type load (const memory_order mo=memory_order_seq_cst) const noexcept
 原子加载指针操作
MSTL_ALWAYS_INLINE_INLINE value_type load (const memory_order mo=memory_order_seq_cst) const volatile noexcept
 volatile版本的原子加载指针操作
MSTL_ALWAYS_INLINE value_type exchange (const value_type ptr, const memory_order mo=memory_order_seq_cst) noexcept
 原子交换指针操作
MSTL_ALWAYS_INLINE_INLINE value_type exchange (const value_type ptr, const memory_order mo=memory_order_seq_cst) volatile noexcept
 volatile版本的原子交换指针操作
MSTL_ALWAYS_INLINE bool compare_exchange_weak (value_type &expected, value_type desired, const memory_order success, const memory_order failure) noexcept
 弱比较交换指针操作
MSTL_ALWAYS_INLINE_INLINE bool compare_exchange_weak (value_type &expected, value_type desired, const memory_order success, const memory_order failure) volatile noexcept
 volatile版本的弱比较交换指针操作
MSTL_ALWAYS_INLINE bool compare_exchange_weak (value_type &expected, value_type desired, const memory_order mo=memory_order_seq_cst) noexcept
 简化版弱比较交换指针操作
MSTL_ALWAYS_INLINE bool compare_exchange_weak (value_type &expected, value_type desired, const memory_order mo=memory_order_seq_cst) volatile noexcept
 volatile版本的简化版弱比较交换指针操作
MSTL_ALWAYS_INLINE bool compare_exchange_strong (value_type &expected, value_type desired, const memory_order success, const memory_order failure) noexcept
 强比较交换指针操作
MSTL_ALWAYS_INLINE_INLINE bool compare_exchange_strong (value_type &expected, value_type desired, const memory_order success, const memory_order failure) volatile noexcept
 volatile版本的强比较交换指针操作
MSTL_ALWAYS_INLINE bool compare_exchange_strong (value_type &expected, value_type desired, const memory_order mo=memory_order_seq_cst) noexcept
 简化版强比较交换指针操作
MSTL_ALWAYS_INLINE bool compare_exchange_strong (value_type &expected, value_type desired, const memory_order mo=memory_order_seq_cst) volatile noexcept
 volatile版本的简化版强比较交换指针操作
MSTL_ALWAYS_INLINE void wait (value_type old, const memory_order mo=memory_order_seq_cst) const noexcept
 等待指针改变
MSTL_ALWAYS_INLINE void notify_one () noexcept
 通知一个等待线程
MSTL_ALWAYS_INLINE void notify_all () noexcept
 通知所有等待线程
MSTL_ALWAYS_INLINE value_type fetch_add (const ptrdiff_t dest, const memory_order mo=memory_order_seq_cst) noexcept
 原子获取并添加指针偏移
MSTL_ALWAYS_INLINE_INLINE value_type fetch_add (const ptrdiff_t dest, const memory_order mo=memory_order_seq_cst) volatile noexcept
 volatile版本的原子获取并添加指针偏移
MSTL_ALWAYS_INLINE value_type fetch_sub (const ptrdiff_t dest, const memory_order mo=memory_order_seq_cst) noexcept
 原子获取并减去指针偏移
MSTL_ALWAYS_INLINE_INLINE value_type fetch_sub (const ptrdiff_t dest, const memory_order mo=memory_order_seq_cst) volatile noexcept
 volatile版本的原子获取并减去指针偏移
value_type operator&= (value_type value) noexcept
 位与赋值运算符
value_type operator|= (value_type value) noexcept
 位或赋值运算符
value_type operator^= (value_type value) noexcept
 位异或赋值运算符
MSTL_ALWAYS_INLINE value_type fetch_and (value_type value, const memory_order mo=memory_order_seq_cst) noexcept
 原子获取并与操作
MSTL_ALWAYS_INLINE value_type fetch_or (value_type value, const memory_order mo=memory_order_seq_cst) noexcept
 原子获取并或操作
MSTL_ALWAYS_INLINE value_type fetch_xor (value_type value, const memory_order mo=memory_order_seq_cst) noexcept
 原子获取并异或操作

静态 Public 属性

static constexpr bool is_always_lock_free
 是否总是无锁
静态 Public 属性 继承自 atomic_base< T * >
static constexpr bool is_always_lock_free = _MSTL is_always_lock_free<sizeof(value_type), alignof(value_type)>()
 是否总是无锁

详细描述

template<typename T>
struct atomic< T * >

指针类型的原子特化

模板参数
T指针指向的类型

在文件 atomic.hpp262 行定义.

成员函数说明

◆ compare_exchange_strong()

bool atomic< T >::compare_exchange_strong ( T & expected,
T desired,
const memory_order success,
const memory_order failure )
inlinenoexcept

强比较交换操作

参数
expected期望值
desired期望设置的值
success成功时的内存顺序
failure失败时的内存顺序
返回
是否交换成功

在文件 atomic.hpp217 行定义.

◆ compare_exchange_weak()

bool atomic< T >::compare_exchange_weak ( T & expected,
T desired,
const memory_order success,
const memory_order failure )
inlinenoexcept

弱比较交换操作

参数
expected期望值
desired期望设置的值
success成功时的内存顺序
failure失败时的内存顺序
返回
是否交换成功

在文件 atomic.hpp174 行定义.

◆ exchange()

T atomic< T >::exchange ( T value,
const memory_order mo = memory_order_seq_cst )
inlinenoexcept

原子交换操作

参数
value要交换的值
mo内存顺序
返回
交换前的值

在文件 atomic.hpp155 行定义.

◆ is_lock_free()

bool atomic< T >::is_lock_free ( ) const
inlinenoexcept

检查是否支持无锁操作

返回
是否支持无锁

在文件 atomic.hpp106 行定义.

◆ load()

T atomic< T >::load ( const memory_order mo = memory_order_seq_cst) const
inlinenoexcept

原子加载操作

参数
mo内存顺序
返回
加载的值

在文件 atomic.hpp138 行定义.

◆ operator T()

atomic< T >::operator T ( ) const
inlinenoexcept

类型转换运算符

返回
当前值

在文件 atomic.hpp73 行定义.

◆ store()

void atomic< T >::store ( T value,
const memory_order mo = memory_order_seq_cst )
inlinenoexcept

原子存储操作

参数
value要存储的值
mo内存顺序

在文件 atomic.hpp122 行定义.


该结构体的文档由以下文件生成: