Snapdragon® Telematics Application Framework (TelAF) Interface Specification
le_atomic.h
Go to the documentation of this file.
1 
14 #ifndef LEGATO_ATOMIC_INCLUDE_GUARD
15 #define LEGATO_ATOMIC_INCLUDE_GUARD
16 
17 #ifdef __GNUC__
18 
22 #define LE_ATOMIC_ORDER_RELAXED __ATOMIC_RELAXED
23 
28 #define LE_ATOMIC_ORDER_ACQUIRE __ATOMIC_ACQUIRE
29 
34 #define LE_ATOMIC_ORDER_RELEASE __ATOMIC_RELEASE
35 
39 #define LE_ATOMIC_ORDER_ACQ_REL __ATOMIC_ACQ_REL
40 
48 #define LE_ATOMIC_TEST_AND_SET(ptr, order) __atomic_test_and_set((ptr), (order))
49 
55 #define LE_ATOMIC_ADD_FETCH(ptr, value, order) __sync_add_and_fetch((ptr), (value))
56 
62 #define LE_ATOMIC_SUB_FETCH(ptr, value, order) __sync_sub_and_fetch((ptr), (value))
63 
69 #define LE_ATOMIC_OR_FETCH(ptr, value, order) __sync_or_and_fetch((ptr), (value))
70 
76 #define LE_ATOMIC_AND_FETCH(ptr, value, order) __sync_and_and_fetch((ptr), (value))
77 
84 #define LE_SYNC_BOOL_COMPARE_AND_SWAP(ptr, oldval, newval) \
85  __sync_bool_compare_and_swap((ptr), (oldval), (newval))
86 
87 #else /* !__GCC__ */
88 
89 // On compilers other than GCC, the framework adaptor must provide an implementation.
90 #ifndef LE_ATOMIC_ORDER_RELAXED
91 #error "The frameworkAdaptor is missing a definition of LE_ATOMIC_ORDER_RELAXED"
92 #endif
93 
94 #ifndef LE_ATOMIC_ORDER_ACQUIRE
95 #error "The frameworkAdaptor is missing a definition of LE_ATOMIC_ORDER_ACQUIRE"
96 #endif
97 
98 #ifndef LE_ATOMIC_ORDER_RELEASE
99 #error "The frameworkAdaptor is missing a definition of LE_ATOMIC_ORDER_RELEASE"
100 #endif
101 
102 #ifndef LE_ATOMIC_ORDER_ACQ_REL
103 #error "The frameworkAdaptor is missing a definition of LE_ATOMIC_ORDER_ACQ_REL"
104 #endif
105 
106 #ifndef LE_ATOMIC_TEST_AND_SET
107 #error "The frameworkAdaptor is missing a definition of LE_ATOMIC_TEST_AND_SET"
108 #endif
109 
110 #ifndef LE_ATOMIC_ADD_FETCH
111 #error "The frameworkAdaptor is missing a definition of LE_ATOMIC_ADD_FETCH"
112 #endif
113 
114 #ifndef LE_ATOMIC_SUB_FETCH
115 #error "The frameworkAdaptor is missing a definition of LE_ATOMIC_SUB_FETCH"
116 #endif
117 
118 #ifndef LE_ATOMIC_OR_FETCH
119 #error "The frameworkAdaptor is missing a definition of LE_ATOMIC_OR_FETCH"
120 #endif
121 
122 #ifndef LE_ATOMIC_AND_FETCH
123 #error "The frameworkAdaptor is missing a definition of LE_ATOMIC_AND_FETCH"
124 #endif
125 
126 #ifndef LE_SYNC_BOOL_COMPARE_AND_SWAP
127 #error "The frameworkAdaptor is missing a definition of LE_SYNC_BOOL_COMPARE_AND_SWAP"
128 #endif
129 
130 #endif /* __GCC__ */
131 
132 #endif // LEGATO_ATOMIC_INCLUDE_GUARD