src/atomic/SDL_spinlock.c
changeset 5557 c1ed57cbfd66
parent 5535 96594ac5fd1a
child 5956 c7aebf1841ca
     1.1 --- a/src/atomic/SDL_spinlock.c	Wed Jun 15 10:28:01 2011 +0100
     1.2 +++ b/src/atomic/SDL_spinlock.c	Wed Jun 22 10:33:48 2011 +0000
     1.3 @@ -77,9 +77,13 @@
     1.4          : "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory");
     1.5      return (result == 0);
     1.6  
     1.7 -#else
     1.8 +#elif HAVE_PTHREAD_SPINLOCK
     1.9 +    /* pthread instructions */
    1.10 +    return (pthread_spin_trylock(lock) == 0);
    1.11 +#else	
    1.12      /* Need CPU instructions for spinlock here! */
    1.13      __need_spinlock_implementation__
    1.14 +	
    1.15  #endif
    1.16  }
    1.17  
    1.18 @@ -101,7 +105,10 @@
    1.19  
    1.20  #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
    1.21      __sync_lock_release(lock);
    1.22 -
    1.23 +    
    1.24 +#elif HAVE_PTHREAD_SPINLOCK
    1.25 +    pthread_spin_unlock(lock);
    1.26 +	
    1.27  #else
    1.28      *lock = 0;
    1.29  #endif