32 #ifndef _GLIBCXX_ATOMIC 33 #define _GLIBCXX_ATOMIC 1 35 #pragma GCC system_header 37 #if __cplusplus < 201103L 44 namespace std _GLIBCXX_VISIBILITY(default)
46 _GLIBCXX_BEGIN_NAMESPACE_VERSION
53 #if __cplusplus >= 201703L 54 # define __cpp_lib_atomic_is_always_lock_free 201603 57 template<
typename _Tp>
65 using value_type = bool;
71 atomic() noexcept =
default;
72 ~
atomic() noexcept =
default;
77 constexpr
atomic(
bool __i) noexcept : _M_base(__i) { }
80 operator=(
bool __i) noexcept
81 {
return _M_base.operator=(__i); }
84 operator=(
bool __i)
volatile noexcept
85 {
return _M_base.operator=(__i); }
87 operator bool()
const noexcept
88 {
return _M_base.load(); }
90 operator bool()
const volatile noexcept
91 {
return _M_base.load(); }
94 is_lock_free()
const noexcept {
return _M_base.is_lock_free(); }
97 is_lock_free()
const volatile noexcept {
return _M_base.is_lock_free(); }
99 #if __cplusplus >= 201703L 104 store(
bool __i,
memory_order __m = memory_order_seq_cst) noexcept
105 { _M_base.store(__i, __m); }
108 store(
bool __i,
memory_order __m = memory_order_seq_cst)
volatile noexcept
109 { _M_base.store(__i, __m); }
112 load(
memory_order __m = memory_order_seq_cst)
const noexcept
113 {
return _M_base.load(__m); }
116 load(
memory_order __m = memory_order_seq_cst)
const volatile noexcept
117 {
return _M_base.load(__m); }
120 exchange(
bool __i,
memory_order __m = memory_order_seq_cst) noexcept
121 {
return _M_base.exchange(__i, __m); }
125 memory_order __m = memory_order_seq_cst)
volatile noexcept
126 {
return _M_base.exchange(__i, __m); }
129 compare_exchange_weak(
bool& __i1,
bool __i2,
memory_order __m1,
131 {
return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
134 compare_exchange_weak(
bool& __i1,
bool __i2,
memory_order __m1,
136 {
return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
139 compare_exchange_weak(
bool& __i1,
bool __i2,
141 {
return _M_base.compare_exchange_weak(__i1, __i2, __m); }
144 compare_exchange_weak(
bool& __i1,
bool __i2,
145 memory_order __m = memory_order_seq_cst)
volatile noexcept
146 {
return _M_base.compare_exchange_weak(__i1, __i2, __m); }
149 compare_exchange_strong(
bool& __i1,
bool __i2,
memory_order __m1,
151 {
return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
154 compare_exchange_strong(
bool& __i1,
bool __i2,
memory_order __m1,
156 {
return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
159 compare_exchange_strong(
bool& __i1,
bool __i2,
161 {
return _M_base.compare_exchange_strong(__i1, __i2, __m); }
164 compare_exchange_strong(
bool& __i1,
bool __i2,
165 memory_order __m = memory_order_seq_cst)
volatile noexcept
166 {
return _M_base.compare_exchange_strong(__i1, __i2, __m); }
175 template<
typename _Tp>
178 using value_type = _Tp;
182 static constexpr
int _S_min_alignment
183 = (
sizeof(_Tp) & (
sizeof(_Tp) - 1)) ||
sizeof(_Tp) > 16
186 static constexpr
int _S_alignment
187 = _S_min_alignment >
alignof(_Tp) ? _S_min_alignment :
alignof(_Tp);
189 alignas(_S_alignment) _Tp _M_i;
191 static_assert(__is_trivially_copyable(_Tp),
192 "std::atomic requires a trivially copyable type");
194 static_assert(
sizeof(_Tp) > 0,
195 "Incomplete or zero-sized types are not supported");
198 atomic() noexcept =
default;
199 ~
atomic() noexcept =
default;
204 constexpr
atomic(_Tp __i) noexcept : _M_i(__i) { }
206 operator _Tp()
const noexcept
209 operator _Tp()
const volatile noexcept
213 operator=(_Tp __i) noexcept
214 { store(__i);
return __i; }
217 operator=(_Tp __i)
volatile noexcept
218 { store(__i);
return __i; }
221 is_lock_free()
const noexcept
224 return __atomic_is_lock_free(
sizeof(_M_i),
225 reinterpret_cast<void *>(-_S_alignment));
229 is_lock_free()
const volatile noexcept
232 return __atomic_is_lock_free(
sizeof(_M_i),
233 reinterpret_cast<void *>(-_S_alignment));
236 #if __cplusplus >= 201703L 237 static constexpr
bool is_always_lock_free
238 = __atomic_always_lock_free(
sizeof(_M_i), 0);
242 store(_Tp __i,
memory_order __m = memory_order_seq_cst) noexcept
246 store(_Tp __i,
memory_order __m = memory_order_seq_cst)
volatile noexcept
250 load(
memory_order __m = memory_order_seq_cst)
const noexcept
252 alignas(_Tp)
unsigned char __buf[
sizeof(_Tp)];
253 _Tp* __ptr =
reinterpret_cast<_Tp*
>(__buf);
259 load(
memory_order __m = memory_order_seq_cst)
const volatile noexcept
261 alignas(_Tp)
unsigned char __buf[
sizeof(_Tp)];
262 _Tp* __ptr =
reinterpret_cast<_Tp*
>(__buf);
270 alignas(_Tp)
unsigned char __buf[
sizeof(_Tp)];
271 _Tp* __ptr =
reinterpret_cast<_Tp*
>(__buf);
279 memory_order __m = memory_order_seq_cst)
volatile noexcept
281 alignas(_Tp)
unsigned char __buf[
sizeof(_Tp)];
282 _Tp* __ptr =
reinterpret_cast<_Tp*
>(__buf);
289 compare_exchange_weak(_Tp& __e, _Tp __i,
memory_order __s,
299 compare_exchange_weak(_Tp& __e, _Tp __i,
memory_order __s,
309 compare_exchange_weak(_Tp& __e, _Tp __i,
311 {
return compare_exchange_weak(__e, __i, __m,
312 __cmpexch_failure_order(__m)); }
315 compare_exchange_weak(_Tp& __e, _Tp __i,
316 memory_order __m = memory_order_seq_cst)
volatile noexcept
317 {
return compare_exchange_weak(__e, __i, __m,
318 __cmpexch_failure_order(__m)); }
321 compare_exchange_strong(_Tp& __e, _Tp __i,
memory_order __s,
331 compare_exchange_strong(_Tp& __e, _Tp __i,
memory_order __s,
341 compare_exchange_strong(_Tp& __e, _Tp __i,
343 {
return compare_exchange_strong(__e, __i, __m,
344 __cmpexch_failure_order(__m)); }
347 compare_exchange_strong(_Tp& __e, _Tp __i,
348 memory_order __m = memory_order_seq_cst)
volatile noexcept
349 {
return compare_exchange_strong(__e, __i, __m,
350 __cmpexch_failure_order(__m)); }
355 template<
typename _Tp>
358 using value_type = _Tp*;
359 using difference_type = ptrdiff_t;
361 typedef _Tp* __pointer_type;
365 atomic() noexcept =
default;
366 ~
atomic() noexcept =
default;
371 constexpr
atomic(__pointer_type __p) noexcept : _M_b(__p) { }
373 operator __pointer_type()
const noexcept
374 {
return __pointer_type(_M_b); }
376 operator __pointer_type()
const volatile noexcept
377 {
return __pointer_type(_M_b); }
380 operator=(__pointer_type __p) noexcept
381 {
return _M_b.operator=(__p); }
384 operator=(__pointer_type __p)
volatile noexcept
385 {
return _M_b.operator=(__p); }
388 operator++(
int) noexcept
390 #if __cplusplus >= 201703L 397 operator++(
int)
volatile noexcept
399 #if __cplusplus >= 201703L 406 operator--(
int) noexcept
408 #if __cplusplus >= 201703L 415 operator--(
int)
volatile noexcept
417 #if __cplusplus >= 201703L 424 operator++() noexcept
426 #if __cplusplus >= 201703L 433 operator++()
volatile noexcept
435 #if __cplusplus >= 201703L 442 operator--() noexcept
444 #if __cplusplus >= 201703L 451 operator--()
volatile noexcept
453 #if __cplusplus >= 201703L 460 operator+=(ptrdiff_t __d) noexcept
462 #if __cplusplus >= 201703L 465 return _M_b.operator+=(__d);
469 operator+=(ptrdiff_t __d)
volatile noexcept
471 #if __cplusplus >= 201703L 474 return _M_b.operator+=(__d);
478 operator-=(ptrdiff_t __d) noexcept
480 #if __cplusplus >= 201703L 483 return _M_b.operator-=(__d);
487 operator-=(ptrdiff_t __d)
volatile noexcept
489 #if __cplusplus >= 201703L 492 return _M_b.operator-=(__d);
496 is_lock_free()
const noexcept
497 {
return _M_b.is_lock_free(); }
500 is_lock_free()
const volatile noexcept
501 {
return _M_b.is_lock_free(); }
503 #if __cplusplus >= 201703L 504 static constexpr
bool is_always_lock_free = ATOMIC_POINTER_LOCK_FREE == 2;
508 store(__pointer_type __p,
510 {
return _M_b.store(__p, __m); }
513 store(__pointer_type __p,
514 memory_order __m = memory_order_seq_cst)
volatile noexcept
515 {
return _M_b.store(__p, __m); }
518 load(
memory_order __m = memory_order_seq_cst)
const noexcept
519 {
return _M_b.load(__m); }
522 load(
memory_order __m = memory_order_seq_cst)
const volatile noexcept
523 {
return _M_b.load(__m); }
528 {
return _M_b.exchange(__p, __m); }
532 memory_order __m = memory_order_seq_cst)
volatile noexcept
533 {
return _M_b.exchange(__p, __m); }
536 compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2,
538 {
return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); }
541 compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2,
544 {
return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); }
547 compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2,
550 return compare_exchange_weak(__p1, __p2, __m,
551 __cmpexch_failure_order(__m));
555 compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2,
556 memory_order __m = memory_order_seq_cst)
volatile noexcept
558 return compare_exchange_weak(__p1, __p2, __m,
559 __cmpexch_failure_order(__m));
563 compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
565 {
return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); }
568 compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
571 {
return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); }
574 compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
577 return _M_b.compare_exchange_strong(__p1, __p2, __m,
578 __cmpexch_failure_order(__m));
582 compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
583 memory_order __m = memory_order_seq_cst)
volatile noexcept
585 return _M_b.compare_exchange_strong(__p1, __p2, __m,
586 __cmpexch_failure_order(__m));
590 fetch_add(ptrdiff_t __d,
593 #if __cplusplus >= 201703L 596 return _M_b.fetch_add(__d, __m);
600 fetch_add(ptrdiff_t __d,
601 memory_order __m = memory_order_seq_cst)
volatile noexcept
603 #if __cplusplus >= 201703L 606 return _M_b.fetch_add(__d, __m);
610 fetch_sub(ptrdiff_t __d,
613 #if __cplusplus >= 201703L 616 return _M_b.fetch_sub(__d, __m);
620 fetch_sub(ptrdiff_t __d,
621 memory_order __m = memory_order_seq_cst)
volatile noexcept
623 #if __cplusplus >= 201703L 626 return _M_b.fetch_sub(__d, __m);
635 typedef char __integral_type;
638 atomic() noexcept =
default;
639 ~
atomic() noexcept =
default;
644 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
646 using __base_type::operator __integral_type;
647 using __base_type::operator=;
649 #if __cplusplus >= 201703L 650 static constexpr
bool is_always_lock_free = ATOMIC_CHAR_LOCK_FREE == 2;
658 typedef signed char __integral_type;
661 atomic() noexcept=
default;
662 ~
atomic() noexcept =
default;
667 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
669 using __base_type::operator __integral_type;
670 using __base_type::operator=;
672 #if __cplusplus >= 201703L 673 static constexpr
bool is_always_lock_free = ATOMIC_CHAR_LOCK_FREE == 2;
681 typedef unsigned char __integral_type;
684 atomic() noexcept=
default;
685 ~
atomic() noexcept =
default;
690 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
692 using __base_type::operator __integral_type;
693 using __base_type::operator=;
695 #if __cplusplus >= 201703L 696 static constexpr
bool is_always_lock_free = ATOMIC_CHAR_LOCK_FREE == 2;
704 typedef short __integral_type;
707 atomic() noexcept =
default;
708 ~
atomic() noexcept =
default;
713 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
715 using __base_type::operator __integral_type;
716 using __base_type::operator=;
718 #if __cplusplus >= 201703L 719 static constexpr
bool is_always_lock_free = ATOMIC_SHORT_LOCK_FREE == 2;
727 typedef unsigned short __integral_type;
730 atomic() noexcept =
default;
731 ~
atomic() noexcept =
default;
736 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
738 using __base_type::operator __integral_type;
739 using __base_type::operator=;
741 #if __cplusplus >= 201703L 742 static constexpr
bool is_always_lock_free = ATOMIC_SHORT_LOCK_FREE == 2;
750 typedef int __integral_type;
753 atomic() noexcept =
default;
754 ~
atomic() noexcept =
default;
759 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
761 using __base_type::operator __integral_type;
762 using __base_type::operator=;
764 #if __cplusplus >= 201703L 765 static constexpr
bool is_always_lock_free = ATOMIC_INT_LOCK_FREE == 2;
773 typedef unsigned int __integral_type;
776 atomic() noexcept =
default;
777 ~
atomic() noexcept =
default;
782 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
784 using __base_type::operator __integral_type;
785 using __base_type::operator=;
787 #if __cplusplus >= 201703L 788 static constexpr
bool is_always_lock_free = ATOMIC_INT_LOCK_FREE == 2;
796 typedef long __integral_type;
799 atomic() noexcept =
default;
800 ~
atomic() noexcept =
default;
805 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
807 using __base_type::operator __integral_type;
808 using __base_type::operator=;
810 #if __cplusplus >= 201703L 811 static constexpr
bool is_always_lock_free = ATOMIC_LONG_LOCK_FREE == 2;
819 typedef unsigned long __integral_type;
822 atomic() noexcept =
default;
823 ~
atomic() noexcept =
default;
828 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
830 using __base_type::operator __integral_type;
831 using __base_type::operator=;
833 #if __cplusplus >= 201703L 834 static constexpr
bool is_always_lock_free = ATOMIC_LONG_LOCK_FREE == 2;
842 typedef long long __integral_type;
845 atomic() noexcept =
default;
846 ~
atomic() noexcept =
default;
851 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
853 using __base_type::operator __integral_type;
854 using __base_type::operator=;
856 #if __cplusplus >= 201703L 857 static constexpr
bool is_always_lock_free = ATOMIC_LLONG_LOCK_FREE == 2;
865 typedef unsigned long long __integral_type;
868 atomic() noexcept =
default;
869 ~
atomic() noexcept =
default;
874 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
876 using __base_type::operator __integral_type;
877 using __base_type::operator=;
879 #if __cplusplus >= 201703L 880 static constexpr
bool is_always_lock_free = ATOMIC_LLONG_LOCK_FREE == 2;
888 typedef wchar_t __integral_type;
891 atomic() noexcept =
default;
892 ~
atomic() noexcept =
default;
897 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
899 using __base_type::operator __integral_type;
900 using __base_type::operator=;
902 #if __cplusplus >= 201703L 903 static constexpr
bool is_always_lock_free = ATOMIC_WCHAR_T_LOCK_FREE == 2;
911 typedef char16_t __integral_type;
914 atomic() noexcept =
default;
915 ~
atomic() noexcept =
default;
920 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
922 using __base_type::operator __integral_type;
923 using __base_type::operator=;
925 #if __cplusplus >= 201703L 926 static constexpr
bool is_always_lock_free = ATOMIC_CHAR16_T_LOCK_FREE == 2;
934 typedef char32_t __integral_type;
937 atomic() noexcept =
default;
938 ~
atomic() noexcept =
default;
943 constexpr
atomic(__integral_type __i) noexcept : __base_type(__i) { }
945 using __base_type::operator __integral_type;
946 using __base_type::operator=;
948 #if __cplusplus >= 201703L 949 static constexpr
bool is_always_lock_free = ATOMIC_CHAR32_T_LOCK_FREE == 2;
999 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 1091 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 1101 atomic_flag_test_and_set_explicit(
atomic_flag* __a,
1103 {
return __a->test_and_set(__m); }
1106 atomic_flag_test_and_set_explicit(
volatile atomic_flag* __a,
1108 {
return __a->test_and_set(__m); }
1112 { __a->clear(__m); }
1115 atomic_flag_clear_explicit(
volatile atomic_flag* __a,
1117 { __a->clear(__m); }
1120 atomic_flag_test_and_set(
atomic_flag* __a) noexcept
1121 {
return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
1124 atomic_flag_test_and_set(
volatile atomic_flag* __a) noexcept
1125 {
return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
1129 { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
1132 atomic_flag_clear(
volatile atomic_flag* __a) noexcept
1133 { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
1136 template<
typename _Tp>
1137 using __atomic_val_t =
typename atomic<_Tp>::value_type;
1138 template<
typename _Tp>
1143 template<
typename _ITp>
1146 {
return __a->is_lock_free(); }
1148 template<
typename _ITp>
1150 atomic_is_lock_free(
const volatile atomic<_ITp>* __a) noexcept
1151 {
return __a->is_lock_free(); }
1153 template<
typename _ITp>
1155 atomic_init(
atomic<_ITp>* __a, __atomic_val_t<_ITp> __i) noexcept
1156 { __a->store(__i, memory_order_relaxed); }
1158 template<
typename _ITp>
1160 atomic_init(
volatile atomic<_ITp>* __a, __atomic_val_t<_ITp> __i) noexcept
1161 { __a->store(__i, memory_order_relaxed); }
1163 template<
typename _ITp>
1165 atomic_store_explicit(
atomic<_ITp>* __a, __atomic_val_t<_ITp> __i,
1167 { __a->store(__i, __m); }
1169 template<
typename _ITp>
1171 atomic_store_explicit(
volatile atomic<_ITp>* __a, __atomic_val_t<_ITp> __i,
1173 { __a->store(__i, __m); }
1175 template<
typename _ITp>
1178 {
return __a->load(__m); }
1180 template<
typename _ITp>
1184 {
return __a->load(__m); }
1186 template<
typename _ITp>
1188 atomic_exchange_explicit(
atomic<_ITp>* __a, __atomic_val_t<_ITp> __i,
1190 {
return __a->exchange(__i, __m); }
1192 template<
typename _ITp>
1195 __atomic_val_t<_ITp> __i,
1197 {
return __a->exchange(__i, __m); }
1199 template<
typename _ITp>
1201 atomic_compare_exchange_weak_explicit(
atomic<_ITp>* __a,
1202 __atomic_val_t<_ITp>* __i1,
1203 __atomic_val_t<_ITp> __i2,
1206 {
return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
1208 template<
typename _ITp>
1210 atomic_compare_exchange_weak_explicit(
volatile atomic<_ITp>* __a,
1211 __atomic_val_t<_ITp>* __i1,
1212 __atomic_val_t<_ITp> __i2,
1215 {
return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
1217 template<
typename _ITp>
1219 atomic_compare_exchange_strong_explicit(
atomic<_ITp>* __a,
1220 __atomic_val_t<_ITp>* __i1,
1221 __atomic_val_t<_ITp> __i2,
1224 {
return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
1226 template<
typename _ITp>
1228 atomic_compare_exchange_strong_explicit(
volatile atomic<_ITp>* __a,
1229 __atomic_val_t<_ITp>* __i1,
1230 __atomic_val_t<_ITp> __i2,
1233 {
return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
1236 template<
typename _ITp>
1238 atomic_store(
atomic<_ITp>* __a, __atomic_val_t<_ITp> __i) noexcept
1239 { atomic_store_explicit(__a, __i, memory_order_seq_cst); }
1241 template<
typename _ITp>
1243 atomic_store(
volatile atomic<_ITp>* __a, __atomic_val_t<_ITp> __i) noexcept
1244 { atomic_store_explicit(__a, __i, memory_order_seq_cst); }
1246 template<
typename _ITp>
1249 {
return atomic_load_explicit(__a, memory_order_seq_cst); }
1251 template<
typename _ITp>
1254 {
return atomic_load_explicit(__a, memory_order_seq_cst); }
1256 template<
typename _ITp>
1258 atomic_exchange(
atomic<_ITp>* __a, __atomic_val_t<_ITp> __i) noexcept
1259 {
return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
1261 template<
typename _ITp>
1264 __atomic_val_t<_ITp> __i) noexcept
1265 {
return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
1267 template<
typename _ITp>
1270 __atomic_val_t<_ITp>* __i1,
1271 __atomic_val_t<_ITp> __i2) noexcept
1273 return atomic_compare_exchange_weak_explicit(__a, __i1, __i2,
1274 memory_order_seq_cst,
1275 memory_order_seq_cst);
1278 template<
typename _ITp>
1280 atomic_compare_exchange_weak(
volatile atomic<_ITp>* __a,
1281 __atomic_val_t<_ITp>* __i1,
1282 __atomic_val_t<_ITp> __i2) noexcept
1284 return atomic_compare_exchange_weak_explicit(__a, __i1, __i2,
1285 memory_order_seq_cst,
1286 memory_order_seq_cst);
1289 template<
typename _ITp>
1292 __atomic_val_t<_ITp>* __i1,
1293 __atomic_val_t<_ITp> __i2) noexcept
1295 return atomic_compare_exchange_strong_explicit(__a, __i1, __i2,
1296 memory_order_seq_cst,
1297 memory_order_seq_cst);
1300 template<
typename _ITp>
1302 atomic_compare_exchange_strong(
volatile atomic<_ITp>* __a,
1303 __atomic_val_t<_ITp>* __i1,
1304 __atomic_val_t<_ITp> __i2) noexcept
1306 return atomic_compare_exchange_strong_explicit(__a, __i1, __i2,
1307 memory_order_seq_cst,
1308 memory_order_seq_cst);
1315 template<
typename _ITp>
1318 __atomic_diff_t<_ITp> __i,
1320 {
return __a->fetch_add(__i, __m); }
1322 template<
typename _ITp>
1325 __atomic_diff_t<_ITp> __i,
1327 {
return __a->fetch_add(__i, __m); }
1329 template<
typename _ITp>
1332 __atomic_diff_t<_ITp> __i,
1334 {
return __a->fetch_sub(__i, __m); }
1336 template<
typename _ITp>
1339 __atomic_diff_t<_ITp> __i,
1341 {
return __a->fetch_sub(__i, __m); }
1343 template<
typename _ITp>
1346 __atomic_val_t<_ITp> __i,
1348 {
return __a->fetch_and(__i, __m); }
1350 template<
typename _ITp>
1353 __atomic_val_t<_ITp> __i,
1355 {
return __a->fetch_and(__i, __m); }
1357 template<
typename _ITp>
1360 __atomic_val_t<_ITp> __i,
1362 {
return __a->fetch_or(__i, __m); }
1364 template<
typename _ITp>
1367 __atomic_val_t<_ITp> __i,
1369 {
return __a->fetch_or(__i, __m); }
1371 template<
typename _ITp>
1374 __atomic_val_t<_ITp> __i,
1376 {
return __a->fetch_xor(__i, __m); }
1378 template<
typename _ITp>
1381 __atomic_val_t<_ITp> __i,
1383 {
return __a->fetch_xor(__i, __m); }
1385 template<
typename _ITp>
1388 __atomic_diff_t<_ITp> __i) noexcept
1389 {
return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
1391 template<
typename _ITp>
1394 __atomic_diff_t<_ITp> __i) noexcept
1395 {
return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
1397 template<
typename _ITp>
1400 __atomic_diff_t<_ITp> __i) noexcept
1401 {
return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
1403 template<
typename _ITp>
1406 __atomic_diff_t<_ITp> __i) noexcept
1407 {
return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
1409 template<
typename _ITp>
1412 __atomic_val_t<_ITp> __i) noexcept
1413 {
return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
1415 template<
typename _ITp>
1418 __atomic_val_t<_ITp> __i) noexcept
1419 {
return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
1421 template<
typename _ITp>
1424 __atomic_val_t<_ITp> __i) noexcept
1425 {
return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
1427 template<
typename _ITp>
1430 __atomic_val_t<_ITp> __i) noexcept
1431 {
return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
1433 template<
typename _ITp>
1436 __atomic_val_t<_ITp> __i) noexcept
1437 {
return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
1439 template<
typename _ITp>
1442 __atomic_val_t<_ITp> __i) noexcept
1443 {
return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
1447 _GLIBCXX_END_NAMESPACE_VERSION
1452 #endif // _GLIBCXX_ATOMIC atomic< int_fast32_t > atomic_int_fast32_t
atomic_int_fast32_t
atomic< int64_t > atomic_int64_t
atomic_int64_t
Explicit specialization for unsigned short.
atomic< uint_fast16_t > atomic_uint_fast16_t
atomic_uint_fast16_t
atomic< long long > atomic_llong
atomic_llong
Explicit specialization for long long.
atomic< uint_least32_t > atomic_uint_least32_t
atomic_uint_least32_t
atomic< int8_t > atomic_int8_t
atomic_int8_t
atomic< int_least8_t > atomic_int_least8_t
atomic_int_least8_t
atomic< uint_least64_t > atomic_uint_least64_t
atomic_uint_least64_t
atomic< int16_t > atomic_int16_t
atomic_int16_t
Explicit specialization for signed char.
atomic< ptrdiff_t > atomic_ptrdiff_t
atomic_ptrdiff_t
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
ISO C++ entities toplevel namespace is std.
Explicit specialization for unsigned int.
atomic< intptr_t > atomic_intptr_t
atomic_intptr_t
Explicit specialization for short.
atomic< signed char > atomic_schar
atomic_schar
atomic< uint_fast32_t > atomic_uint_fast32_t
atomic_uint_fast32_t
atomic< int_least64_t > atomic_int_least64_t
atomic_int_least64_t
Explicit specialization for char.
atomic< uint32_t > atomic_uint32_t
atomic_uint32_t
Generic atomic type, primary class template.
_Tp exchange(_Tp &__obj, _Up &&__new_val)
Assign __new_val to __obj and return its previous value.
Explicit specialization for wchar_t.
atomic< unsigned long > atomic_ulong
atomic_ulong
atomic< uint_fast8_t > atomic_uint_fast8_t
atomic_uint_fast8_t
atomic< char16_t > atomic_char16_t
atomic_char16_t
Explicit specialization for unsigned long.
atomic< uintmax_t > atomic_uintmax_t
atomic_uintmax_t
Explicit specialization for int.
Explicit specialization for unsigned char.
atomic< uint_least8_t > atomic_uint_least8_t
atomic_uint_least8_t
atomic< long > atomic_long
atomic_long
Explicit specialization for char32_t.
Explicit specialization for unsigned long long.
atomic< unsigned char > atomic_uchar
atomic_uchar
Explicit specialization for long.
atomic< int_least16_t > atomic_int_least16_t
atomic_int_least16_t
atomic< unsigned short > atomic_ushort
atomic_ushort
atomic< int > atomic_int
atomic_int
atomic< int32_t > atomic_int32_t
atomic_int32_t
atomic< unsigned int > atomic_uint
atomic_uint
atomic< int_fast64_t > atomic_int_fast64_t
atomic_int_fast64_t
atomic< uint64_t > atomic_uint64_t
atomic_uint64_t
#define ATOMIC_BOOL_LOCK_FREE
Explicit specialization for char16_t.
atomic< uint8_t > atomic_uint8_t
atomic_uint8_t
atomic< uint_least16_t > atomic_uint_least16_t
atomic_uint_least16_t
atomic< bool > atomic_bool
atomic_bool
atomic< intmax_t > atomic_intmax_t
atomic_intmax_t
atomic< wchar_t > atomic_wchar_t
atomic_wchar_t
atomic< size_t > atomic_size_t
atomic_size_t
atomic< uintptr_t > atomic_uintptr_t
atomic_uintptr_t
atomic< int_fast8_t > atomic_int_fast8_t
atomic_int_fast8_t
atomic< int_fast16_t > atomic_int_fast16_t
atomic_int_fast16_t
atomic< char > atomic_char
atomic_char
atomic< unsigned long long > atomic_ullong
atomic_ullong
memory_order
Enumeration for memory_order.
atomic< uint_fast64_t > atomic_uint_fast64_t
atomic_uint_fast64_t
atomic< int_least32_t > atomic_int_least32_t
atomic_int_least32_t
atomic< short > atomic_short
atomic_short
atomic< uint16_t > atomic_uint16_t
atomic_uint16_t
atomic< char32_t > atomic_char32_t
atomic_char32_t