@@ -14,11 +14,12 @@ * file. */ #import "objfw-defs.h" -#if !defined(OF_THREADS) || (!defined(OF_HAVE_PTHREADS) && !defined(_WIN32)) +#if !defined(OF_HAVE_THREADS) || \ + (!defined(OF_HAVE_PTHREADS) && !defined(_WIN32)) # error No threads available! #endif #import "macros.h" @@ -37,11 +38,11 @@ HANDLE event; int count; } of_condition_t; #endif -#if defined(OF_ATOMIC_OPS) +#if defined(OF_HAVE_ATOMIC_OPS) # import "atomic.h" typedef volatile int of_spinlock_t; # define OF_SPINCOUNT 10 #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) typedef pthread_spinlock_t of_spinlock_t; @@ -295,11 +296,11 @@ } static OF_INLINE BOOL of_spinlock_new(of_spinlock_t *spinlock) { -#if defined(OF_ATOMIC_OPS) +#if defined(OF_HAVE_ATOMIC_OPS) *spinlock = 0; return YES; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_init(spinlock, 0); #else @@ -308,11 +309,11 @@ } static OF_INLINE BOOL of_spinlock_trylock(of_spinlock_t *spinlock) { -#if defined(OF_ATOMIC_OPS) +#if defined(OF_HAVE_ATOMIC_OPS) return of_atomic_cmpswap_int(spinlock, 0, 1); #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_trylock(spinlock); #else return of_mutex_trylock(spinlock); @@ -320,11 +321,11 @@ } static OF_INLINE BOOL of_spinlock_lock(of_spinlock_t *spinlock) { -#if defined(OF_ATOMIC_OPS) +#if defined(OF_HAVE_ATOMIC_OPS) # if defined(OF_HAVE_SCHED_YIELD) || defined(_WIN32) int i; for (i = 0; i < OF_SPINCOUNT; i++) if (of_spinlock_trylock(spinlock)) @@ -349,11 +350,11 @@ } static OF_INLINE BOOL of_spinlock_unlock(of_spinlock_t *spinlock) { -#if defined(OF_ATOMIC_OPS) +#if defined(OF_HAVE_ATOMIC_OPS) *spinlock = 0; return YES; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_unlock(spinlock); #else @@ -362,11 +363,11 @@ } static OF_INLINE BOOL of_spinlock_free(of_spinlock_t *spinlock) { -#if defined(OF_ATOMIC_OPS) +#if defined(OF_HAVE_ATOMIC_OPS) return YES; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_destroy(spinlock); #else return of_mutex_free(spinlock);