Subclause | Header | ||
Requirements | |||
Stop tokens | <stop_token> | ||
Threads | <thread> | ||
Atomic operations | <atomic>, <stdatomic.h> | ||
Mutual exclusion | <mutex>, <shared_mutex> | ||
Condition variables | <condition_variable> | ||
Semaphores | <semaphore> | ||
Coordination types | <latch>, <barrier> | ||
Futures | <future> | ||
Safe reclamation | <rcu>, <hazard_pointer> |
m.lock()
m.unlock()
m.try_lock()
m.try_lock_for(rel_time)
m.try_lock_until(abs_time)
void swap(stop_token& rhs) noexcept;
bool stop_requested() const noexcept;
bool stop_possible() const noexcept;
stop_source();
void swap(stop_source& rhs) noexcept;
stop_token get_token() const noexcept;
bool stop_possible() const noexcept;
bool stop_requested() const noexcept;
bool request_stop() noexcept;
template<class Initializer>
explicit stop_callback(const stop_token& st, Initializer&& init)
noexcept(is_nothrow_constructible_v<CallbackFn, Initializer>);
template<class Initializer>
explicit stop_callback(stop_token&& st, Initializer&& init)
noexcept(is_nothrow_constructible_v<CallbackFn, Initializer>);
~stop_callback();
void swap(inplace_stop_token& rhs) noexcept;
bool stop_requested() const noexcept;
stop_possible() const noexcept;
constexpr inplace_stop_source() noexcept;
constexpr inplace_stop_token get_token() const noexcept;
bool stop_requested() const noexcept;
bool request_stop() noexcept;
template<class Initializer>
explicit inplace_stop_callback(inplace_stop_token st, Initializer&& init)
noexcept(is_nothrow_constructible_v<CallbackFn, Initializer>);
~inplace_stop_callback();
id() noexcept;
bool operator==(thread::id x, thread::id y) noexcept;
strong_ordering operator<=>(thread::id x, thread::id y) noexcept;
template<class charT, class traits>
basic_ostream<charT, traits>&
operator<< (basic_ostream<charT, traits>& out, thread::id id);
template<class charT> struct formatter<thread::id, charT>;
template<> struct hash<thread::id>;
thread() noexcept;
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
thread(thread&& x) noexcept;
~thread();
void swap(thread& x) noexcept;
bool joinable() const noexcept;
void join();
void detach();
id get_id() const noexcept;
unsigned hardware_concurrency() noexcept;
jthread() noexcept;
template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
jthread(jthread&& x) noexcept;
~jthread();
jthread& operator=(jthread&& x) noexcept;
void swap(jthread& x) noexcept;
bool joinable() const noexcept;
void join();
void detach();
id get_id() const noexcept;
stop_source get_stop_source() noexcept;
stop_token get_stop_token() const noexcept;
bool request_stop() noexcept;
friend void swap(jthread& x, jthread& y) noexcept;
thread::id this_thread::get_id() noexcept;
void this_thread::yield() noexcept;
template<class Clock, class Duration>
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
template<class Rep, class Period>
void sleep_for(const chrono::duration<Rep, Period>& rel_time);
template<class T>
T kill_dependency(T y) noexcept;
static constexpr size_t required_alignment;
static constexpr bool is_always_lock_free;
bool is_lock_free() const noexcept;
atomic_ref(T& obj);
atomic_ref(const atomic_ref& ref) noexcept;
void store(T desired, memory_order order = memory_order::seq_cst) const noexcept;
T operator=(T desired) const noexcept;
T load(memory_order order = memory_order::seq_cst) const noexcept;
operator T() const noexcept;
T exchange(T desired, memory_order order = memory_order::seq_cst) const noexcept;
bool compare_exchange_weak(T& expected, T desired,
memory_order success, memory_order failure) const noexcept;
bool compare_exchange_strong(T& expected, T desired,
memory_order success, memory_order failure) const noexcept;
bool compare_exchange_weak(T& expected, T desired,
memory_order order = memory_order::seq_cst) const noexcept;
bool compare_exchange_strong(T& expected, T desired,
memory_order order = memory_order::seq_cst) const noexcept;
void wait(T old, memory_order order = memory_order::seq_cst) const noexcept;
void notify_one() const noexcept;
void notify_all() const noexcept;
integral-type fetch_key(integral-type operand,
memory_order order = memory_order::seq_cst) const noexcept;
integral-type operator op=(integral-type operand) const noexcept;
floating-point-type fetch_key(floating-point-type operand,
memory_order order = memory_order::seq_cst) const noexcept;
floating-point-type operator op=(floating-point-type operand) const noexcept;
T* fetch_key(difference_type operand, memory_order order = memory_order::seq_cst) const noexcept;
T* operator op=(difference_type operand) const noexcept;
value_type operator++(int) const noexcept;
value_type operator--(int) const noexcept;
value_type operator++() const noexcept;
value_type operator--() const noexcept;
constexpr atomic() noexcept(is_nothrow_default_constructible_v<T>);
constexpr atomic(T desired) noexcept;
void store(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
void store(T desired, memory_order order = memory_order::seq_cst) noexcept;
T operator=(T desired) volatile noexcept;
T operator=(T desired) noexcept;
T load(memory_order order = memory_order::seq_cst) const volatile noexcept;
T load(memory_order order = memory_order::seq_cst) const noexcept;
operator T() const volatile noexcept;
operator T() const noexcept;
T exchange(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
T exchange(T desired, memory_order order = memory_order::seq_cst) noexcept;
bool compare_exchange_weak(T& expected, T desired,
memory_order success, memory_order failure) volatile noexcept;
bool compare_exchange_weak(T& expected, T desired,
memory_order success, memory_order failure) noexcept;
bool compare_exchange_strong(T& expected, T desired,
memory_order success, memory_order failure) volatile noexcept;
bool compare_exchange_strong(T& expected, T desired,
memory_order success, memory_order failure) noexcept;
bool compare_exchange_weak(T& expected, T desired,
memory_order order = memory_order::seq_cst) volatile noexcept;
bool compare_exchange_weak(T& expected, T desired,
memory_order order = memory_order::seq_cst) noexcept;
bool compare_exchange_strong(T& expected, T desired,
memory_order order = memory_order::seq_cst) volatile noexcept;
bool compare_exchange_strong(T& expected, T desired,
memory_order order = memory_order::seq_cst) noexcept;
void wait(T old, memory_order order = memory_order::seq_cst) const volatile noexcept;
void wait(T old, memory_order order = memory_order::seq_cst) const noexcept;
void notify_one() volatile noexcept;
void notify_one() noexcept;
void notify_all() volatile noexcept;
void notify_all() noexcept;
T fetch_key(T operand, memory_order order = memory_order::seq_cst) volatile noexcept;
T fetch_key(T operand, memory_order order = memory_order::seq_cst) noexcept;
T operator op=(T operand) volatile noexcept;
T operator op=(T operand) noexcept;
T fetch_key(T operand, memory_order order = memory_order::seq_cst) volatile noexcept;
T fetch_key(T operand, memory_order order = memory_order::seq_cst) noexcept;
T operator op=(T operand) volatile noexcept;
T operator op=(T operand) noexcept;
key | Op | Computation | key | Op | Computation | |
add | + | addition | sub | - | subtraction | |
max | maximum | min | minimum |
T* fetch_key(ptrdiff_t operand, memory_order order = memory_order::seq_cst) volatile noexcept;
T* fetch_key(ptrdiff_t operand, memory_order order = memory_order::seq_cst) noexcept;
T* operator op=(ptrdiff_t operand) volatile noexcept;
T* operator op=(ptrdiff_t operand) noexcept;
value_type operator++(int) volatile noexcept;
value_type operator++(int) noexcept;
value_type operator--(int) volatile noexcept;
value_type operator--(int) noexcept;
value_type operator++() volatile noexcept;
value_type operator++() noexcept;
value_type operator--() volatile noexcept;
value_type operator--() noexcept;
constexpr atomic() noexcept;
atomic(weak_ptr<T> desired) noexcept;
void store(weak_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;
void operator=(weak_ptr<T> desired) noexcept;
weak_ptr<T> load(memory_order order = memory_order::seq_cst) const noexcept;
operator weak_ptr<T>() const noexcept;
weak_ptr<T> exchange(weak_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;
bool compare_exchange_weak(weak_ptr<T>& expected, weak_ptr<T> desired,
memory_order success, memory_order failure) noexcept;
bool compare_exchange_strong(weak_ptr<T>& expected, weak_ptr<T> desired,
memory_order success, memory_order failure) noexcept;
bool compare_exchange_weak(weak_ptr<T>& expected, weak_ptr<T> desired,
memory_order order = memory_order::seq_cst) noexcept;
bool compare_exchange_strong(weak_ptr<T>& expected, weak_ptr<T> desired,
memory_order order = memory_order::seq_cst) noexcept;
void wait(weak_ptr<T> old, memory_order order = memory_order::seq_cst) const noexcept;
void notify_one() noexcept;
void notify_all() noexcept;
constexpr atomic_flag::atomic_flag() noexcept;
bool atomic_flag_test(const volatile atomic_flag* object) noexcept;
bool atomic_flag_test(const atomic_flag* object) noexcept;
bool atomic_flag_test_explicit(const volatile atomic_flag* object,
memory_order order) noexcept;
bool atomic_flag_test_explicit(const atomic_flag* object,
memory_order order) noexcept;
bool atomic_flag::test(memory_order order = memory_order::seq_cst) const volatile noexcept;
bool atomic_flag::test(memory_order order = memory_order::seq_cst) const noexcept;
bool atomic_flag_test_and_set(volatile atomic_flag* object) noexcept;
bool atomic_flag_test_and_set(atomic_flag* object) noexcept;
bool atomic_flag_test_and_set_explicit(volatile atomic_flag* object, memory_order order) noexcept;
bool atomic_flag_test_and_set_explicit(atomic_flag* object, memory_order order) noexcept;
bool atomic_flag::test_and_set(memory_order order = memory_order::seq_cst) volatile noexcept;
bool atomic_flag::test_and_set(memory_order order = memory_order::seq_cst) noexcept;
void atomic_flag_clear(volatile atomic_flag* object) noexcept;
void atomic_flag_clear(atomic_flag* object) noexcept;
void atomic_flag_clear_explicit(volatile atomic_flag* object, memory_order order) noexcept;
void atomic_flag_clear_explicit(atomic_flag* object, memory_order order) noexcept;
void atomic_flag::clear(memory_order order = memory_order::seq_cst) volatile noexcept;
void atomic_flag::clear(memory_order order = memory_order::seq_cst) noexcept;
void atomic_flag_wait(const volatile atomic_flag* object, bool old) noexcept;
void atomic_flag_wait(const atomic_flag* object, bool old) noexcept;
void atomic_flag_wait_explicit(const volatile atomic_flag* object,
bool old, memory_order order) noexcept;
void atomic_flag_wait_explicit(const atomic_flag* object,
bool old, memory_order order) noexcept;
void atomic_flag::wait(bool old, memory_order order =
memory_order::seq_cst) const volatile noexcept;
void atomic_flag::wait(bool old, memory_order order =
memory_order::seq_cst) const noexcept;
void atomic_flag_notify_one(volatile atomic_flag* object) noexcept;
void atomic_flag_notify_one(atomic_flag* object) noexcept;
void atomic_flag::notify_one() volatile noexcept;
void atomic_flag::notify_one() noexcept;
void atomic_flag_notify_all(volatile atomic_flag* object) noexcept;
void atomic_flag_notify_all(atomic_flag* object) noexcept;
void atomic_flag::notify_all() volatile noexcept;
void atomic_flag::notify_all() noexcept;
#define ATOMIC_FLAG_INIT see below
extern "C" void atomic_thread_fence(memory_order order) noexcept;
extern "C" void atomic_signal_fence(memory_order order) noexcept;