src/atomic/SDL_atomic.c
changeset 10950 fd1b8fd3b937
parent 10947 56a0a429d309
child 10972 e9d71390bedf
equal deleted inserted replaced
10949:96539b1f6069 10950:fd1b8fd3b937
   209 }
   209 }
   210 
   210 
   211 int
   211 int
   212 SDL_AtomicGet(SDL_atomic_t *a)
   212 SDL_AtomicGet(SDL_atomic_t *a)
   213 {
   213 {
   214 /* !!! FIXME: __atomic_load_n is only in newer GCCs and Clang, I think, and apparently not on Android. This #ifdef should be more exact. */
   214 #if defined(HAVE_GCC_ATOMICS) && (__GNUC__ >= 5)
   215 #if defined(HAVE_GCC_ATOMICS) && !defined(__ANDROID__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
       
   216     return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST);
   215     return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST);
   217 #else
   216 #else
   218     int value;
   217     int value;
   219     do {
   218     do {
   220         value = a->value;
   219         value = a->value;
   224 }
   223 }
   225 
   224 
   226 void *
   225 void *
   227 SDL_AtomicGetPtr(void **a)
   226 SDL_AtomicGetPtr(void **a)
   228 {
   227 {
   229 /* !!! FIXME: __atomic_load_n is only in newer GCCs and Clang, I think, and apparently not on Android. This #ifdef should be more exact. */
   228 #if defined(HAVE_GCC_ATOMICS) && (__GNUC__ >= 5)
   230 #if defined(HAVE_GCC_ATOMICS) && !defined(__ANDROID__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
       
   231     return __atomic_load_n(a, __ATOMIC_SEQ_CST);
   229     return __atomic_load_n(a, __ATOMIC_SEQ_CST);
   232 #else
   230 #else
   233     void *value;
   231     void *value;
   234     do {
   232     do {
   235         value = *a;
   233         value = *a;