MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
atomic_futex< WaiterBit > 模板类 参考

原子快速用户态互斥锁类模板 更多...

#include <atomic_futex.hpp>

Public 成员函数

 atomic_futex (const uint32_t data)
 构造函数
MSTL_NODISCARD MSTL_ALWAYS_INLINE uint32_t load (const memory_order mo) const
 原子加载数据
MSTL_ALWAYS_INLINE uint32_t load_when_not_equal (const uint32_t value, const memory_order mo)
 等待直到值不等于指定值
MSTL_ALWAYS_INLINE void load_when_equal (const uint32_t value, const memory_order mo)
 等待直到值等于指定值
template<typename Rep, typename Period>
MSTL_ALWAYS_INLINE bool load_when_equal_for (const uint32_t value, const memory_order mo, const duration< Rep, Period > &rtime)
 在指定时间内等待值等于指定值
template<typename Clock, typename Dur>
MSTL_ALWAYS_INLINE bool load_when_equal_until (const uint32_t value, const memory_order mo, const time_point< Clock, Dur > &atime)
 在指定时间点前等待值等于指定值(通用时钟)
template<typename Dur>
MSTL_ALWAYS_INLINE bool load_when_equal_until (const uint32_t value, const memory_order mo, const time_point< system_clock, Dur > &atime)
 在指定时间点前等待值等于指定值(系统时钟)
template<typename Dur>
MSTL_ALWAYS_INLINE bool load_when_equal_until (const uint32_t value, const memory_order mo, const time_point< steady_clock, Dur > &atime)
 在指定时间点前等待值等于指定值(单调时钟)
MSTL_ALWAYS_INLINE void store_notify_all (const uint32_t value, const memory_order mo)
 存储新值并通知所有等待线程

详细描述

template<uint32_t WaiterBit = 0x80000000>
class atomic_futex< WaiterBit >

原子快速用户态互斥锁类模板

模板参数
WaiterBit等待者标志位,默认为0x80000000

基于FUTEX实现的用户态互斥锁, 提供高效的线程同步机制,减少不必要的上下文切换。

在文件 atomic_futex.hpp31 行定义.

构造及析构函数说明

◆ atomic_futex()

template<uint32_t WaiterBit = 0x80000000>
atomic_futex< WaiterBit >::atomic_futex ( const uint32_t data)
inlineexplicit

构造函数

参数
data初始数据值

在文件 atomic_futex.hpp149 行定义.

引用了 data().

成员函数说明

◆ load()

template<uint32_t WaiterBit = 0x80000000>
MSTL_NODISCARD MSTL_ALWAYS_INLINE uint32_t atomic_futex< WaiterBit >::load ( const memory_order mo) const
inline

原子加载数据

参数
mo内存顺序
返回
加载的数据值(清除等待者标志位)
注解
清除等待者标志位,只返回实际数据

在文件 atomic_futex.hpp160 行定义.

被这些函数引用 load_when_equal(), load_when_equal_until(), load_when_equal_until() , 以及 load_when_not_equal().

◆ load_when_equal()

template<uint32_t WaiterBit = 0x80000000>
MSTL_ALWAYS_INLINE void atomic_futex< WaiterBit >::load_when_equal ( const uint32_t value,
const memory_order mo )
inline

等待直到值等于指定值

参数
value期望相等的值
mo内存顺序

阻塞当前线程,直到数据值等于指定的值。

在文件 atomic_futex.hpp189 行定义.

引用了 load().

◆ load_when_equal_for()

template<uint32_t WaiterBit = 0x80000000>
template<typename Rep, typename Period>
MSTL_ALWAYS_INLINE bool atomic_futex< WaiterBit >::load_when_equal_for ( const uint32_t value,
const memory_order mo,
const duration< Rep, Period > & rtime )
inline

在指定时间内等待值等于指定值

模板参数
Rep时间表示类型
Period时间单位比例
参数
value期望相等的值
mo内存顺序
rtime相对超时时间
返回
是否在超时前等到相等

在文件 atomic_futex.hpp208 行定义.

引用了 ceil(), load_when_equal_until() , 以及 steady_clock::now().

◆ load_when_equal_until() [1/3]

template<uint32_t WaiterBit = 0x80000000>
template<typename Clock, typename Dur>
MSTL_ALWAYS_INLINE bool atomic_futex< WaiterBit >::load_when_equal_until ( const uint32_t value,
const memory_order mo,
const time_point< Clock, Dur > & atime )
inline

在指定时间点前等待值等于指定值(通用时钟)

模板参数
Clock时钟类型
Dur持续时间类型
参数
value期望相等的值
mo内存顺序
atime绝对超时时间点
返回
是否在超时前等到相等
注解
将其他时钟转换为单调时钟进行处理

在文件 atomic_futex.hpp227 行定义.

引用了 _MSTL, ceil(), load_when_equal_until() , 以及 steady_clock::now().

被这些函数引用 load_when_equal_for() , 以及 load_when_equal_until().

◆ load_when_equal_until() [2/3]

template<uint32_t WaiterBit = 0x80000000>
template<typename Dur>
MSTL_ALWAYS_INLINE bool atomic_futex< WaiterBit >::load_when_equal_until ( const uint32_t value,
const memory_order mo,
const time_point< steady_clock, Dur > & atime )
inline

在指定时间点前等待值等于指定值(单调时钟)

模板参数
Dur持续时间类型
参数
value期望相等的值
mo内存顺序
atime绝对超时时间点(单调时钟)
返回
是否在超时前等到相等

在文件 atomic_futex.hpp270 行定义.

引用了 load().

◆ load_when_equal_until() [3/3]

template<uint32_t WaiterBit = 0x80000000>
template<typename Dur>
MSTL_ALWAYS_INLINE bool atomic_futex< WaiterBit >::load_when_equal_until ( const uint32_t value,
const memory_order mo,
const time_point< system_clock, Dur > & atime )
inline

在指定时间点前等待值等于指定值(系统时钟)

模板参数
Dur持续时间类型
参数
value期望相等的值
mo内存顺序
atime绝对超时时间点
返回
是否在超时前等到相等

在文件 atomic_futex.hpp250 行定义.

引用了 load().

◆ load_when_not_equal()

template<uint32_t WaiterBit = 0x80000000>
MSTL_ALWAYS_INLINE uint32_t atomic_futex< WaiterBit >::load_when_not_equal ( const uint32_t value,
const memory_order mo )
inline

等待直到值不等于指定值

参数
value期望不相等的值
mo内存顺序
返回
当前值(当不等于指定值时)

阻塞当前线程,直到数据值不等于指定的值。

在文件 atomic_futex.hpp173 行定义.

引用了 load().

◆ store_notify_all()

template<uint32_t WaiterBit = 0x80000000>
MSTL_ALWAYS_INLINE void atomic_futex< WaiterBit >::store_notify_all ( const uint32_t value,
const memory_order mo )
inline

存储新值并通知所有等待线程

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

原子地存储新值,如果有等待线程,则唤醒所有等待线程。

在文件 atomic_futex.hpp287 行定义.

引用了 _MSTL , 以及 futex_notify().


该类的文档由以下文件生成: