1*35238bceSAndroid Build Coastguard Worker #ifndef _DEATOMIC_H
2*35238bceSAndroid Build Coastguard Worker #define _DEATOMIC_H
3*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker * drawElements Thread Library
5*35238bceSAndroid Build Coastguard Worker * ---------------------------
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
8*35238bceSAndroid Build Coastguard Worker *
9*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
10*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
11*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
14*35238bceSAndroid Build Coastguard Worker *
15*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
16*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
17*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
19*35238bceSAndroid Build Coastguard Worker * limitations under the License.
20*35238bceSAndroid Build Coastguard Worker *
21*35238bceSAndroid Build Coastguard Worker *//*!
22*35238bceSAndroid Build Coastguard Worker * \file
23*35238bceSAndroid Build Coastguard Worker * \brief Atomic operations.
24*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
25*35238bceSAndroid Build Coastguard Worker
26*35238bceSAndroid Build Coastguard Worker #include "deDefs.h"
27*35238bceSAndroid Build Coastguard Worker
28*35238bceSAndroid Build Coastguard Worker #if (DE_COMPILER == DE_COMPILER_MSC)
29*35238bceSAndroid Build Coastguard Worker #include <intrin.h>
30*35238bceSAndroid Build Coastguard Worker #endif
31*35238bceSAndroid Build Coastguard Worker
32*35238bceSAndroid Build Coastguard Worker DE_BEGIN_EXTERN_C
33*35238bceSAndroid Build Coastguard Worker
34*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
35*35238bceSAndroid Build Coastguard Worker * \brief Atomic increment and fetch 32-bit signed integer.
36*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
37*35238bceSAndroid Build Coastguard Worker * \return Incremented value.
38*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicIncrementInt32(volatile int32_t * dstAddr)39*35238bceSAndroid Build Coastguard Worker DE_INLINE int32_t deAtomicIncrementInt32(volatile int32_t *dstAddr)
40*35238bceSAndroid Build Coastguard Worker {
41*35238bceSAndroid Build Coastguard Worker #if (DE_COMPILER == DE_COMPILER_MSC)
42*35238bceSAndroid Build Coastguard Worker return _InterlockedIncrement((long volatile *)dstAddr);
43*35238bceSAndroid Build Coastguard Worker #elif (DE_COMPILER == DE_COMPILER_GCC) || (DE_COMPILER == DE_COMPILER_CLANG)
44*35238bceSAndroid Build Coastguard Worker return __sync_add_and_fetch(dstAddr, 1);
45*35238bceSAndroid Build Coastguard Worker #else
46*35238bceSAndroid Build Coastguard Worker #error "Implement deAtomicIncrementInt32()"
47*35238bceSAndroid Build Coastguard Worker #endif
48*35238bceSAndroid Build Coastguard Worker }
49*35238bceSAndroid Build Coastguard Worker
50*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
51*35238bceSAndroid Build Coastguard Worker * \brief Atomic increment and fetch 32-bit unsigned integer.
52*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
53*35238bceSAndroid Build Coastguard Worker * \return Incremented value.
54*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicIncrementUint32(volatile uint32_t * dstAddr)55*35238bceSAndroid Build Coastguard Worker DE_INLINE uint32_t deAtomicIncrementUint32(volatile uint32_t *dstAddr)
56*35238bceSAndroid Build Coastguard Worker {
57*35238bceSAndroid Build Coastguard Worker return deAtomicIncrementInt32((int32_t volatile *)dstAddr);
58*35238bceSAndroid Build Coastguard Worker }
59*35238bceSAndroid Build Coastguard Worker
60*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
61*35238bceSAndroid Build Coastguard Worker * \brief Atomic decrement and fetch 32-bit signed integer.
62*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
63*35238bceSAndroid Build Coastguard Worker * \return Decremented value.
64*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicDecrementInt32(volatile int32_t * dstAddr)65*35238bceSAndroid Build Coastguard Worker DE_INLINE int32_t deAtomicDecrementInt32(volatile int32_t *dstAddr)
66*35238bceSAndroid Build Coastguard Worker {
67*35238bceSAndroid Build Coastguard Worker #if (DE_COMPILER == DE_COMPILER_MSC)
68*35238bceSAndroid Build Coastguard Worker return _InterlockedDecrement((volatile long *)dstAddr);
69*35238bceSAndroid Build Coastguard Worker #elif (DE_COMPILER == DE_COMPILER_GCC) || (DE_COMPILER == DE_COMPILER_CLANG)
70*35238bceSAndroid Build Coastguard Worker return __sync_sub_and_fetch(dstAddr, 1);
71*35238bceSAndroid Build Coastguard Worker #else
72*35238bceSAndroid Build Coastguard Worker #error "Implement deAtomicDecrementInt32()"
73*35238bceSAndroid Build Coastguard Worker #endif
74*35238bceSAndroid Build Coastguard Worker }
75*35238bceSAndroid Build Coastguard Worker
76*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
77*35238bceSAndroid Build Coastguard Worker * \brief Atomic decrement and fetch 32-bit unsigned integer.
78*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
79*35238bceSAndroid Build Coastguard Worker * \return Decremented value.
80*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicDecrementUint32(volatile uint32_t * dstAddr)81*35238bceSAndroid Build Coastguard Worker DE_INLINE uint32_t deAtomicDecrementUint32(volatile uint32_t *dstAddr)
82*35238bceSAndroid Build Coastguard Worker {
83*35238bceSAndroid Build Coastguard Worker return deAtomicDecrementInt32((volatile int32_t *)dstAddr);
84*35238bceSAndroid Build Coastguard Worker }
85*35238bceSAndroid Build Coastguard Worker
86*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
87*35238bceSAndroid Build Coastguard Worker * \brief Atomic compare and exchange (CAS) 32-bit value.
88*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
89*35238bceSAndroid Build Coastguard Worker * \param compare Old value.
90*35238bceSAndroid Build Coastguard Worker * \param exchange New value.
91*35238bceSAndroid Build Coastguard Worker * \return compare value if CAS passes, *dstAddr value otherwise
92*35238bceSAndroid Build Coastguard Worker *
93*35238bceSAndroid Build Coastguard Worker * Performs standard Compare-And-Swap with 32b data. Dst value is compared
94*35238bceSAndroid Build Coastguard Worker * to compare value and if that comparison passes, value is replaced with
95*35238bceSAndroid Build Coastguard Worker * exchange value.
96*35238bceSAndroid Build Coastguard Worker *
97*35238bceSAndroid Build Coastguard Worker * If CAS succeeds, compare value is returned. Otherwise value stored in
98*35238bceSAndroid Build Coastguard Worker * dstAddr is returned.
99*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicCompareExchangeUint32(volatile uint32_t * dstAddr,uint32_t compare,uint32_t exchange)100*35238bceSAndroid Build Coastguard Worker DE_INLINE uint32_t deAtomicCompareExchangeUint32(volatile uint32_t *dstAddr, uint32_t compare, uint32_t exchange)
101*35238bceSAndroid Build Coastguard Worker {
102*35238bceSAndroid Build Coastguard Worker #if (DE_COMPILER == DE_COMPILER_MSC)
103*35238bceSAndroid Build Coastguard Worker return _InterlockedCompareExchange((volatile long *)dstAddr, exchange, compare);
104*35238bceSAndroid Build Coastguard Worker #elif (DE_COMPILER == DE_COMPILER_GCC) || (DE_COMPILER == DE_COMPILER_CLANG)
105*35238bceSAndroid Build Coastguard Worker return __sync_val_compare_and_swap(dstAddr, compare, exchange);
106*35238bceSAndroid Build Coastguard Worker #else
107*35238bceSAndroid Build Coastguard Worker #error "Implement deAtomicCompareExchange32()"
108*35238bceSAndroid Build Coastguard Worker #endif
109*35238bceSAndroid Build Coastguard Worker }
110*35238bceSAndroid Build Coastguard Worker
111*35238bceSAndroid Build Coastguard Worker /* Deprecated names */
112*35238bceSAndroid Build Coastguard Worker #define deAtomicIncrement32 deAtomicIncrementInt32
113*35238bceSAndroid Build Coastguard Worker #define deAtomicDecrement32 deAtomicDecrementInt32
114*35238bceSAndroid Build Coastguard Worker #define deAtomicCompareExchange32 deAtomicCompareExchangeUint32
115*35238bceSAndroid Build Coastguard Worker
116*35238bceSAndroid Build Coastguard Worker #if (DE_PTR_SIZE == 8)
117*35238bceSAndroid Build Coastguard Worker
118*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
119*35238bceSAndroid Build Coastguard Worker * \brief Atomic increment and fetch 64-bit signed integer.
120*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
121*35238bceSAndroid Build Coastguard Worker * \return Incremented value.
122*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicIncrementInt64(volatile int64_t * dstAddr)123*35238bceSAndroid Build Coastguard Worker DE_INLINE int64_t deAtomicIncrementInt64(volatile int64_t *dstAddr)
124*35238bceSAndroid Build Coastguard Worker {
125*35238bceSAndroid Build Coastguard Worker #if (DE_COMPILER == DE_COMPILER_MSC)
126*35238bceSAndroid Build Coastguard Worker return _InterlockedIncrement64((volatile long long *)dstAddr);
127*35238bceSAndroid Build Coastguard Worker #elif (DE_COMPILER == DE_COMPILER_GCC) || (DE_COMPILER == DE_COMPILER_CLANG)
128*35238bceSAndroid Build Coastguard Worker return __sync_add_and_fetch(dstAddr, 1);
129*35238bceSAndroid Build Coastguard Worker #else
130*35238bceSAndroid Build Coastguard Worker #error "Implement deAtomicIncrementInt64()"
131*35238bceSAndroid Build Coastguard Worker #endif
132*35238bceSAndroid Build Coastguard Worker }
133*35238bceSAndroid Build Coastguard Worker
134*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
135*35238bceSAndroid Build Coastguard Worker * \brief Atomic increment and fetch 64-bit unsigned integer.
136*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
137*35238bceSAndroid Build Coastguard Worker * \return Incremented value.
138*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicIncrementUint64(volatile uint64_t * dstAddr)139*35238bceSAndroid Build Coastguard Worker DE_INLINE uint64_t deAtomicIncrementUint64(volatile uint64_t *dstAddr)
140*35238bceSAndroid Build Coastguard Worker {
141*35238bceSAndroid Build Coastguard Worker return deAtomicIncrementInt64((volatile int64_t *)dstAddr);
142*35238bceSAndroid Build Coastguard Worker }
143*35238bceSAndroid Build Coastguard Worker
144*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
145*35238bceSAndroid Build Coastguard Worker * \brief Atomic decrement and fetch.
146*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
147*35238bceSAndroid Build Coastguard Worker * \return Decremented value.
148*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicDecrementInt64(volatile int64_t * dstAddr)149*35238bceSAndroid Build Coastguard Worker DE_INLINE int64_t deAtomicDecrementInt64(volatile int64_t *dstAddr)
150*35238bceSAndroid Build Coastguard Worker {
151*35238bceSAndroid Build Coastguard Worker #if (DE_COMPILER == DE_COMPILER_MSC)
152*35238bceSAndroid Build Coastguard Worker return _InterlockedDecrement64((volatile long long *)dstAddr);
153*35238bceSAndroid Build Coastguard Worker #elif (DE_COMPILER == DE_COMPILER_GCC) || (DE_COMPILER == DE_COMPILER_CLANG)
154*35238bceSAndroid Build Coastguard Worker return __sync_sub_and_fetch(dstAddr, 1);
155*35238bceSAndroid Build Coastguard Worker #else
156*35238bceSAndroid Build Coastguard Worker #error "Implement deAtomicDecrementInt64()"
157*35238bceSAndroid Build Coastguard Worker #endif
158*35238bceSAndroid Build Coastguard Worker }
159*35238bceSAndroid Build Coastguard Worker
160*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
161*35238bceSAndroid Build Coastguard Worker * \brief Atomic increment and fetch 64-bit unsigned integer.
162*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
163*35238bceSAndroid Build Coastguard Worker * \return Incremented value.
164*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicDecrementUint64(volatile uint64_t * dstAddr)165*35238bceSAndroid Build Coastguard Worker DE_INLINE uint64_t deAtomicDecrementUint64(volatile uint64_t *dstAddr)
166*35238bceSAndroid Build Coastguard Worker {
167*35238bceSAndroid Build Coastguard Worker return deAtomicDecrementInt64((volatile int64_t *)dstAddr);
168*35238bceSAndroid Build Coastguard Worker }
169*35238bceSAndroid Build Coastguard Worker
170*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
171*35238bceSAndroid Build Coastguard Worker * \brief Atomic compare and exchange (CAS) 64-bit value.
172*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
173*35238bceSAndroid Build Coastguard Worker * \param compare Old value.
174*35238bceSAndroid Build Coastguard Worker * \param exchange New value.
175*35238bceSAndroid Build Coastguard Worker * \return compare value if CAS passes, *dstAddr value otherwise
176*35238bceSAndroid Build Coastguard Worker *
177*35238bceSAndroid Build Coastguard Worker * Performs standard Compare-And-Swap with 64b data. Dst value is compared
178*35238bceSAndroid Build Coastguard Worker * to compare value and if that comparison passes, value is replaced with
179*35238bceSAndroid Build Coastguard Worker * exchange value.
180*35238bceSAndroid Build Coastguard Worker *
181*35238bceSAndroid Build Coastguard Worker * If CAS succeeds, compare value is returned. Otherwise value stored in
182*35238bceSAndroid Build Coastguard Worker * dstAddr is returned.
183*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicCompareExchangeUint64(volatile uint64_t * dstAddr,uint64_t compare,uint64_t exchange)184*35238bceSAndroid Build Coastguard Worker DE_INLINE uint64_t deAtomicCompareExchangeUint64(volatile uint64_t *dstAddr, uint64_t compare, uint64_t exchange)
185*35238bceSAndroid Build Coastguard Worker {
186*35238bceSAndroid Build Coastguard Worker #if (DE_COMPILER == DE_COMPILER_MSC)
187*35238bceSAndroid Build Coastguard Worker return _InterlockedCompareExchange64((volatile long long *)dstAddr, exchange, compare);
188*35238bceSAndroid Build Coastguard Worker #elif (DE_COMPILER == DE_COMPILER_GCC) || (DE_COMPILER == DE_COMPILER_CLANG)
189*35238bceSAndroid Build Coastguard Worker return __sync_val_compare_and_swap(dstAddr, compare, exchange);
190*35238bceSAndroid Build Coastguard Worker #else
191*35238bceSAndroid Build Coastguard Worker #error "Implement deAtomicCompareExchangeUint64()"
192*35238bceSAndroid Build Coastguard Worker #endif
193*35238bceSAndroid Build Coastguard Worker }
194*35238bceSAndroid Build Coastguard Worker
195*35238bceSAndroid Build Coastguard Worker #endif /* (DE_PTR_SIZE == 8) */
196*35238bceSAndroid Build Coastguard Worker
197*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
198*35238bceSAndroid Build Coastguard Worker * \brief Atomic increment and fetch size_t.
199*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
200*35238bceSAndroid Build Coastguard Worker * \return Incremented value.
201*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicIncrementUSize(volatile size_t * size)202*35238bceSAndroid Build Coastguard Worker DE_INLINE size_t deAtomicIncrementUSize(volatile size_t *size)
203*35238bceSAndroid Build Coastguard Worker {
204*35238bceSAndroid Build Coastguard Worker #if (DE_PTR_SIZE == 8)
205*35238bceSAndroid Build Coastguard Worker return deAtomicIncrementUint64((volatile uint64_t *)size);
206*35238bceSAndroid Build Coastguard Worker #elif (DE_PTR_SIZE == 4)
207*35238bceSAndroid Build Coastguard Worker return deAtomicIncrementUint32((volatile uint32_t *)size);
208*35238bceSAndroid Build Coastguard Worker #else
209*35238bceSAndroid Build Coastguard Worker #error "Invalid DE_PTR_SIZE value"
210*35238bceSAndroid Build Coastguard Worker #endif
211*35238bceSAndroid Build Coastguard Worker }
212*35238bceSAndroid Build Coastguard Worker
213*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
214*35238bceSAndroid Build Coastguard Worker * \brief Atomic increment and fetch size_t.
215*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
216*35238bceSAndroid Build Coastguard Worker * \return Incremented value.
217*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicDecrementUSize(volatile size_t * size)218*35238bceSAndroid Build Coastguard Worker DE_INLINE size_t deAtomicDecrementUSize(volatile size_t *size)
219*35238bceSAndroid Build Coastguard Worker {
220*35238bceSAndroid Build Coastguard Worker #if (DE_PTR_SIZE == 8)
221*35238bceSAndroid Build Coastguard Worker return deAtomicDecrementUint64((volatile uint64_t *)size);
222*35238bceSAndroid Build Coastguard Worker #elif (DE_PTR_SIZE == 4)
223*35238bceSAndroid Build Coastguard Worker return deAtomicDecrementUint32((volatile uint32_t *)size);
224*35238bceSAndroid Build Coastguard Worker #else
225*35238bceSAndroid Build Coastguard Worker #error "Invalid DE_PTR_SIZE value"
226*35238bceSAndroid Build Coastguard Worker #endif
227*35238bceSAndroid Build Coastguard Worker }
228*35238bceSAndroid Build Coastguard Worker
229*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
230*35238bceSAndroid Build Coastguard Worker * \brief Atomic compare and exchange (CAS) pointer.
231*35238bceSAndroid Build Coastguard Worker * \param dstAddr Destination address.
232*35238bceSAndroid Build Coastguard Worker * \param compare Old value.
233*35238bceSAndroid Build Coastguard Worker * \param exchange New value.
234*35238bceSAndroid Build Coastguard Worker * \return compare value if CAS passes, *dstAddr value otherwise
235*35238bceSAndroid Build Coastguard Worker *
236*35238bceSAndroid Build Coastguard Worker * Performs standard Compare-And-Swap with pointer value. Dst value is compared
237*35238bceSAndroid Build Coastguard Worker * to compare value and if that comparison passes, value is replaced with
238*35238bceSAndroid Build Coastguard Worker * exchange value.
239*35238bceSAndroid Build Coastguard Worker *
240*35238bceSAndroid Build Coastguard Worker * If CAS succeeds, compare value is returned. Otherwise value stored in
241*35238bceSAndroid Build Coastguard Worker * dstAddr is returned.
242*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
deAtomicCompareExchangePtr(void * volatile * dstAddr,void * compare,void * exchange)243*35238bceSAndroid Build Coastguard Worker DE_INLINE void *deAtomicCompareExchangePtr(void *volatile *dstAddr, void *compare, void *exchange)
244*35238bceSAndroid Build Coastguard Worker {
245*35238bceSAndroid Build Coastguard Worker #if (DE_PTR_SIZE == 8)
246*35238bceSAndroid Build Coastguard Worker return (void *)deAtomicCompareExchangeUint64((volatile uint64_t *)dstAddr, (uint64_t)compare, (uint64_t)exchange);
247*35238bceSAndroid Build Coastguard Worker #elif (DE_PTR_SIZE == 4)
248*35238bceSAndroid Build Coastguard Worker return (void *)deAtomicCompareExchangeUint32((volatile uint32_t *)dstAddr, (uint32_t)compare, (uint32_t)exchange);
249*35238bceSAndroid Build Coastguard Worker #else
250*35238bceSAndroid Build Coastguard Worker #error "Invalid DE_PTR_SIZE value"
251*35238bceSAndroid Build Coastguard Worker #endif
252*35238bceSAndroid Build Coastguard Worker }
253*35238bceSAndroid Build Coastguard Worker
254*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
255*35238bceSAndroid Build Coastguard Worker * \brief Issue hardware memory read-write fence.
256*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
257*35238bceSAndroid Build Coastguard Worker #if (DE_COMPILER == DE_COMPILER_MSC)
258*35238bceSAndroid Build Coastguard Worker void deMemoryReadWriteFence(void);
259*35238bceSAndroid Build Coastguard Worker #elif (DE_COMPILER == DE_COMPILER_GCC) || (DE_COMPILER == DE_COMPILER_CLANG)
deMemoryReadWriteFence(void)260*35238bceSAndroid Build Coastguard Worker DE_INLINE void deMemoryReadWriteFence(void)
261*35238bceSAndroid Build Coastguard Worker {
262*35238bceSAndroid Build Coastguard Worker __sync_synchronize();
263*35238bceSAndroid Build Coastguard Worker }
264*35238bceSAndroid Build Coastguard Worker #else
265*35238bceSAndroid Build Coastguard Worker #error "Implement deMemoryReadWriteFence()"
266*35238bceSAndroid Build Coastguard Worker #endif
267*35238bceSAndroid Build Coastguard Worker
268*35238bceSAndroid Build Coastguard Worker DE_END_EXTERN_C
269*35238bceSAndroid Build Coastguard Worker
270*35238bceSAndroid Build Coastguard Worker #endif /* _DEATOMIC_H */
271