Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -60,11 +60,11 @@ struct pre_ivar { void **memoryChunks; unsigned int memoryChunksSize; int32_t retainCount; -#if !defined(OF_ATOMIC_OPS) +#if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS) of_spinlock_t retainCountSpinlock; #endif }; /* Hopefully no arch needs more than 16 bytes padding */ @@ -192,11 +192,11 @@ ((struct pre_ivar*)instance)->memoryChunks = NULL; ((struct pre_ivar*)instance)->memoryChunksSize = 0; ((struct pre_ivar*)instance)->retainCount = 1; -#if !defined(OF_ATOMIC_OPS) +#if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS) if (!of_spinlock_new( &((struct pre_ivar*)instance)->retainCountSpinlock)) { free(instance); @throw [OFInitializationFailedException exceptionWithClass: self]; @@ -1009,14 +1009,16 @@ - retain { #if defined(OF_ATOMIC_OPS) of_atomic_inc_32(&PRE_IVAR->retainCount); -#else +#elif defined(OF_THREADS) assert(of_spinlock_lock(&PRE_IVAR->retainCountSpinlock)); PRE_IVAR->retainCount++; assert(of_spinlock_unlock(&PRE_IVAR->retainCountSspinlock)); +#else + PRE_IVAR->retainCount++; #endif return self; } @@ -1029,18 +1031,21 @@ - (void)release { #if defined(OF_ATOMIC_OPS) if (of_atomic_dec_32(&PRE_IVAR->retainCount) <= 0) [self dealloc]; -#else +#elif defined(OF_THREADS) size_t c; assert(of_spinlock_lock(&PRE_IVAR->retainCountSpinlock)); c = --PRE_IVAR->retainCount; assert(of_spinlock_unlock(&PRE_IVAR->retainCountSpinlock)); - if (!c) + if (c == 0) + [self dealloc]; +#else + if (--PRE_IVAR->retainCount == 0) [self dealloc]; #endif } - autorelease