Mercurial > sdl-ios-xcode
changeset 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 | adf6f0c8ec35 |
files | include/SDL.h include/SDL_atomic.h src/SDL_assert.c test/testatomic.c |
diffstat | 4 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/include/SDL.h Sun Jan 16 15:31:09 2011 -0800 +++ b/include/SDL.h Sun Jan 16 17:45:42 2011 -0800 @@ -76,7 +76,6 @@ #include "SDL_main.h" #include "SDL_stdinc.h" -#include "SDL_atomic.h" #include "SDL_audio.h" #include "SDL_clipboard.h" #include "SDL_cpuinfo.h"
--- 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.