Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Include windows.h in SDL_atomic.h by default, but don't include the a…

…tomic 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
  • Loading branch information
slouken committed Jan 17, 2011
1 parent 41baa9c commit 9719cfa88e6b818ddd40ed8b9f9fb63dddd111d0
Showing with 12 additions and 5 deletions.
  1. +0 −1 include/SDL.h
  2. +9 −4 include/SDL_atomic.h
  3. +1 −0 src/SDL_assert.c
  4. +2 −0 test/testatomic.c
@@ -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"
@@ -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.
@@ -21,6 +21,7 @@
*/

#include "SDL.h"
#include "SDL_atomic.h"
#include "SDL_assert.h"
#include "SDL_assert_c.h"
#include "video/SDL_sysvideo.h"
@@ -1,5 +1,7 @@
#include <stdio.h>

#include "SDL.h"
#include "SDL_atomic.h"
#include "SDL_assert.h"

/*

0 comments on commit 9719cfa

Please sign in to comment.