summaryrefslogtreecommitdiff
path: root/include/SDL_atomic.h
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2011-01-16 17:45:42 -0800
committerSam Lantinga <slouken@libsdl.org>2011-01-16 17:45:42 -0800
commitc94b5b6866af4a949ac48054529818680975bdfa (patch)
tree35e7f4d6b6f46303784c057ac6dfa116bcf9a2be /include/SDL_atomic.h
parent4c5bf24ecbf84d56532eb89f9288061651366e29 (diff)
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
Diffstat (limited to 'include/SDL_atomic.h')
-rw-r--r--include/SDL_atomic.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/SDL_atomic.h b/include/SDL_atomic.h
index 26f66ae508..69db17c18c 100644
--- a/include/SDL_atomic.h
+++ b/include/SDL_atomic.h
@@ -107,14 +107,16 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
/*@}*//*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 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
#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.