diff include/SDL_atomic.h @ 5006:8e8876e4aec6

Include windows.h in SDL_atomic.h by default, but don't include the atomic API in SDL.h This allows all SDL code to take advantage of the atomic intrinsics on Windows, but doesn't cause applications just including SDL.h to pull in windows.h
author Sam Lantinga <slouken@libsdl.org>
date Sun, 16 Jan 2011 17:45:42 -0800
parents 7f0265279b68
children 2e282002bac3
line wrap: on
line diff
--- a/include/SDL_atomic.h	Sun Jan 16 15:31:09 2011 -0800
+++ b/include/SDL_atomic.h	Sun Jan 16 17:45:42 2011 -0800
@@ -107,14 +107,16 @@
 
 /*@}*//*SDL AtomicLock*/
 
-/* Platform specific optimized versions of the atomic functions */
-#if defined(__WIN32__) && defined(_INC_WINDOWS)
+/* Platform specific optimized versions of the atomic functions,
+ * you can disable these by defining SDL_DISABLE_ATOMIC_INLINE
+ */
+#ifndef SDL_DISABLE_ATOMIC_INLINE
+
+#if defined(__WIN32__)
 /* Don't include windows.h, since it may hose code that isn't expecting it,
    but if someone has already included it, this is fair game... */
-#if 0
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-#endif
 
 #define SDL_AtomicSet(a, v)     InterlockedExchange(&(a)->value, v)
 #define SDL_AtomicGet(a)        ((a)->value)
@@ -169,6 +171,9 @@
 
 #endif
 
+#endif /* !SDL_DISABLE_ATOMIC_INLINE */
+
+
 /**
  * \brief A type representing an atomic integer value.  It is a struct
  *        so people don't accidentally use numeric operations on it.