Namespaces
Variants

std::atomic_flag:: test

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
bool test ( std:: memory_order order =
std:: memory_order_seq_cst ) const volatile noexcept ;
(1) (自 C++20 起)
bool test ( std:: memory_order order =
std:: memory_order_seq_cst ) const noexcept ;
(2) (自 C++20 起)

原子地读取 * this 的值并返回该值。

如果 order std:: memory_order_release std:: memory_order_acq_rel 之一,则行为未定义。

目录

参数

order - 内存同步顺序

返回值

原子读取的值。

示例

参见

原子地返回标志的值
(函数)