include/SDL_atomic.h
changeset 9278 8900afb78a19
parent 8979 1e283b7a1580
child 9619 b94b6d0bff0f
equal deleted inserted replaced
9277:f0bd40782fc7 9278:8900afb78a19
   120  */
   120  */
   121 #if defined(_MSC_VER) && (_MSC_VER > 1200)
   121 #if defined(_MSC_VER) && (_MSC_VER > 1200)
   122 void _ReadWriteBarrier(void);
   122 void _ReadWriteBarrier(void);
   123 #pragma intrinsic(_ReadWriteBarrier)
   123 #pragma intrinsic(_ReadWriteBarrier)
   124 #define SDL_CompilerBarrier()   _ReadWriteBarrier()
   124 #define SDL_CompilerBarrier()   _ReadWriteBarrier()
   125 #elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
   125 #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
   126 /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
   126 /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
   127 #define SDL_CompilerBarrier()   __asm__ __volatile__ ("" : : : "memory")
   127 #define SDL_CompilerBarrier()   __asm__ __volatile__ ("" : : : "memory")
   128 #else
   128 #else
   129 #define SDL_CompilerBarrier()   \
   129 #define SDL_CompilerBarrier()   \
   130 { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
   130 { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }