29 #ifndef _GLIBCXX_ATOMICITY_H
30 #define _GLIBCXX_ATOMICITY_H 1
32 #pragma GCC system_header
34 #include <bits/c++config.h>
35 #include <bits/gthr.h>
36 #include <bits/atomic_word.h>
40 _GLIBCXX_BEGIN_NAMESPACE_VERSION
46 #ifdef _GLIBCXX_ATOMIC_BUILTINS
47 static inline _Atomic_word
48 __exchange_and_add(
volatile _Atomic_word* __mem,
int __val)
49 {
return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
52 __atomic_add(
volatile _Atomic_word* __mem,
int __val)
53 { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
57 __exchange_and_add(
volatile _Atomic_word*,
int)
throw ();
61 __atomic_add(
volatile _Atomic_word*,
int)
throw ();
64 static inline _Atomic_word
65 __exchange_and_add_single(_Atomic_word* __mem,
int __val)
67 _Atomic_word __result = *__mem;
73 __atomic_add_single(_Atomic_word* __mem,
int __val)
76 static inline _Atomic_word
78 __exchange_and_add_dispatch(_Atomic_word* __mem,
int __val)
81 if (__gthread_active_p())
82 return __exchange_and_add(__mem, __val);
84 return __exchange_and_add_single(__mem, __val);
86 return __exchange_and_add_single(__mem, __val);
92 __atomic_add_dispatch(_Atomic_word* __mem,
int __val)
95 if (__gthread_active_p())
96 __atomic_add(__mem, __val);
98 __atomic_add_single(__mem, __val);
100 __atomic_add_single(__mem, __val);
104 _GLIBCXX_END_NAMESPACE_VERSION
110 #ifndef _GLIBCXX_READ_MEM_BARRIER
111 #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory")
113 #ifndef _GLIBCXX_WRITE_MEM_BARRIER
114 #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory")
double __v4df __attribute__((__vector_size__(32)))
Definition: avxintrin.h:32
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
Definition: atomicity.h:38