Namespaces
Variants
Views
Actions

std::atomic_flag_test, std::atomic_flag_test_explicit

From cppreference.com
< cpp‎ | atomic
 
 
Concurrency support library
Threads
(C++11)
(C++20)
(C++20)
this_thread namespace
(C++11)
(C++11)
(C++11)
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11)(deprecated in C++20)
(C++11)(deprecated in C++20)
Free functions for atomic operations
Free functions for atomic flags
atomic_flag_testatomic_flag_test_explicit
(C++20)(C++20)
Memory ordering
Mutual exclusion
(C++11)
Generic lock management
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
Condition variables
(C++11)
Semaphores
Latches and barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
(C++11)
 
Defined in header <atomic>
(1) (since C++20)
bool atomic_flag_test( const volatile std::atomic_flag* object ) noexcept;
bool atomic_flag_test( const std::atomic_flag* object ) noexcept;
(2) (since C++20)
bool atomic_flag_test_explicit( const volatile std::atomic_flag* object,
                                std::memory_order order ) noexcept;
bool atomic_flag_test_explicit( const std::atomic_flag* object,
                                std::memory_order order ) noexcept;

Atomically reads the value of the *object and returns the value.

1) Equivalent to object->test(std::memory_order_seq_cst).
2) Equivalent to object->test(order).

Contents

[edit] Parameters

object - pointer to the atomic_flag object to read
order - the memory synchronization ordering for this operation: must not be std::memory_order::release or std::memory_order::acq_rel

[edit] Return value

The value atomically read.

[edit] Notes

Feature-test macro
__cpp_lib_atomic_flag_test

[edit] Example

[edit] See also

(C++20)
atomically returns the value of the flag
(public member function of std::atomic_flag) [edit]