libstdc++
stdatomic.h
Go to the documentation of this file.
1// C compatibility header <stdatomic.h> -*- C++ -*-
2
3// Copyright The GNU Toolchain Authors.
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
24
25/** @file include/stdatomic.h
26 * This is a Standard C++ Library header.
27 */
28
29#ifndef _GLIBCXX_STDATOMIC_H
30#define _GLIBCXX_STDATOMIC_H
31
32#if __cplusplus > 202002L
33#include <atomic>
34
35#define __cpp_lib_stdatomic_h 202011L
36
37#define _Atomic(_Tp) std::atomic<_Tp>
38
40using std::memory_order_relaxed;
41using std::memory_order_consume;
42using std::memory_order_acquire;
43using std::memory_order_release;
44using std::memory_order_acq_rel;
45using std::memory_order_seq_cst;
53using std::atomic_int;
59#ifdef _GLIBCXX_USE_CHAR8_T
60using std::atomic_char8_t;
61#endif
65#ifdef _GLIBCXX_USE_C99_STDINT_TR1
90#endif
95#ifdef _GLIBCXX_USE_C99_STDINT_TR1
98#endif
99using std::atomic_is_lock_free;
100using std::atomic_load;
101using std::atomic_load_explicit;
102using std::atomic_store;
103using std::atomic_store_explicit;
104using std::atomic_exchange;
105using std::atomic_exchange_explicit;
106using std::atomic_compare_exchange_strong;
107using std::atomic_compare_exchange_strong_explicit;
108using std::atomic_compare_exchange_weak;
109using std::atomic_compare_exchange_weak_explicit;
110using std::atomic_fetch_add;
111using std::atomic_fetch_add_explicit;
112using std::atomic_fetch_sub;
113using std::atomic_fetch_sub_explicit;
114using std::atomic_fetch_or;
115using std::atomic_fetch_or_explicit;
116using std::atomic_fetch_xor;
117using std::atomic_fetch_xor_explicit;
118using std::atomic_fetch_and;
119using std::atomic_fetch_and_explicit;
120using std::atomic_flag_test_and_set;
121using std::atomic_flag_test_and_set_explicit;
122using std::atomic_flag_clear;
123using std::atomic_flag_clear_explicit;
124using std::atomic_thread_fence;
125using std::atomic_signal_fence;
126
127#elif defined __clang__
128# include_next <stdatomic.h>
129#endif // C++23
130#endif // _GLIBCXX_STDATOMIC_H
memory_order
Enumeration for memory_order.
Definition: atomic_base.h:62
Generic atomic type, primary class template.
Definition: atomic:197
atomic<bool>
Definition: atomic:63
Explicit specialization for char.
Definition: atomic:710
Explicit specialization for signed char.
Definition: atomic:733
Explicit specialization for unsigned char.
Definition: atomic:756
Explicit specialization for short.
Definition: atomic:779
Explicit specialization for unsigned short.
Definition: atomic:802
Explicit specialization for int.
Definition: atomic:825
Explicit specialization for unsigned int.
Definition: atomic:848
Explicit specialization for long.
Definition: atomic:871
Explicit specialization for unsigned long.
Definition: atomic:894
Explicit specialization for long long.
Definition: atomic:917
Explicit specialization for unsigned long long.
Definition: atomic:940
Explicit specialization for wchar_t.
Definition: atomic:963
Explicit specialization for char16_t.
Definition: atomic:1012
Explicit specialization for char32_t.
Definition: atomic:1036
atomic_flag
Definition: atomic_base.h:197