Commit d428d9d5 authored by Sam Lantinga's avatar Sam Lantinga

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
parent 57d90f79
......@@ -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"
......
#include <stdio.h>
#include "SDL.h"
#include "SDL_atomic.h"
#include "SDL_assert.h"
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment