src/atomic/SDL_spinlock.c
changeset 5015 1bf9e38431ec
parent 5004 0c72ae7b7cb2
child 5028 fffb33ae85e8
     1.1 --- a/src/atomic/SDL_spinlock.c	Mon Jan 17 14:05:14 2011 -0800
     1.2 +++ b/src/atomic/SDL_spinlock.c	Mon Jan 17 14:05:43 2011 -0800
     1.3 @@ -25,8 +25,7 @@
     1.4  #include "SDL_timer.h"
     1.5  
     1.6  #if defined(__WIN32__)
     1.7 -#define WIN32_LEAN_AND_MEAN
     1.8 -#include <windows.h>
     1.9 +#include <intrin.h>
    1.10  
    1.11  #elif defined(__MACOSX__)
    1.12  #include <libkern/OSAtomic.h>
    1.13 @@ -39,7 +38,8 @@
    1.14  SDL_AtomicTryLock(SDL_SpinLock *lock)
    1.15  {
    1.16  #if defined(__WIN32__)
    1.17 -    return (InterlockedExchange(lock, 1) == 0);
    1.18 +    SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long));
    1.19 +    return (_InterlockedExchange((long*)lock, 1) == 0);
    1.20  
    1.21  #elif defined(__MACOSX__)
    1.22      return OSAtomicCompareAndSwap32Barrier(0, 1, lock);