Mercurial > sdl-ios-xcode
comparison src/atomic/SDL_spinlock.c @ 5092:327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
I think this also fixes the bug relating to non-latin characters in filenames, since UNICODE wasn't defined in SDL_rwops.c
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 24 Jan 2011 21:20:30 -0800 |
parents | c2539ff054c8 |
children | 2164a79b5ca9 |
comparison
equal
deleted
inserted
replaced
5091:79bd1e289005 | 5092:327f181542f1 |
---|---|
23 | 23 |
24 #include "SDL_atomic.h" | 24 #include "SDL_atomic.h" |
25 #include "SDL_timer.h" | 25 #include "SDL_timer.h" |
26 | 26 |
27 /* Don't do the check for Visual Studio 2005, it's safe here */ | 27 /* Don't do the check for Visual Studio 2005, it's safe here */ |
28 #if defined(_MSC_VER) | 28 #include "../core/windows/SDL_windows.h" |
29 #ifdef _WIN32_WCE | |
30 #define WIN32_LEAN_AND_MEAN | |
31 #include <windows.h> | |
32 #else | |
33 #include <intrin.h> | |
34 #endif | |
35 #endif /* _MSC_VER */ | |
36 | 29 |
37 /* This function is where all the magic happens... */ | 30 /* This function is where all the magic happens... */ |
38 SDL_bool | 31 SDL_bool |
39 SDL_AtomicTryLock(SDL_SpinLock *lock) | 32 SDL_AtomicTryLock(SDL_SpinLock *lock) |
40 { | 33 { |
41 #if defined(_MSC_VER) | 34 #if defined(_MSC_VER) |
42 SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long)); | 35 SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long)); |
43 return (_InterlockedExchange((long*)lock, 1) == 0); | 36 return (InterlockedExchange((long*)lock, 1) == 0); |
44 | 37 |
45 #elif defined(__MACOSX__) | 38 #elif defined(__MACOSX__) |
46 return OSAtomicCompareAndSwap32Barrier(0, 1, lock); | 39 return OSAtomicCompareAndSwap32Barrier(0, 1, lock); |
47 | 40 |
48 #elif defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET) | 41 #elif defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET) |