@@ -22,18 +22,18 @@ #ifdef OF_HAVE_THREADS # import "mutex.h" # define NUM_SPINLOCKS 8 /* needs to be a power of 2 */ # define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1)) -static of_spinlock_t spinlocks[NUM_SPINLOCKS]; +static OFSpinlock spinlocks[NUM_SPINLOCKS]; #endif #ifdef OF_HAVE_THREADS OF_CONSTRUCTOR() { for (size_t i = 0; i < NUM_SPINLOCKS; i++) - if (of_spinlock_new(&spinlocks[i]) != 0) + if (OFSpinlockNew(&spinlocks[i]) != 0) OBJC_ERROR("Failed to initialize spinlocks!"); } #endif id @@ -42,15 +42,15 @@ if (atomic) { id *ptr = (id *)(void *)((char *)self + offset); #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(ptr); - OF_ENSURE(of_spinlock_lock(&spinlocks[hash]) == 0); + OF_ENSURE(OFSpinlockLock(&spinlocks[hash]) == 0); @try { return [[*ptr retain] autorelease]; } @finally { - OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]) == 0); + OF_ENSURE(OFSpinlockUnlock(&spinlocks[hash]) == 0); } #else return [[*ptr retain] autorelease]; #endif } @@ -65,11 +65,11 @@ if (atomic) { id *ptr = (id *)(void *)((char *)self + offset); #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(ptr); - OF_ENSURE(of_spinlock_lock(&spinlocks[hash]) == 0); + OF_ENSURE(OFSpinlockLock(&spinlocks[hash]) == 0); @try { #endif id old = *ptr; switch (copy) { @@ -84,11 +84,11 @@ } [old release]; #ifdef OF_HAVE_THREADS } @finally { - OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]) == 0); + OF_ENSURE(OFSpinlockUnlock(&spinlocks[hash]) == 0); } #endif return; } @@ -117,15 +117,15 @@ { if (atomic) { #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(src); - OF_ENSURE(of_spinlock_lock(&spinlocks[hash]) == 0); + OF_ENSURE(OFSpinlockLock(&spinlocks[hash]) == 0); #endif memcpy(dest, src, size); #ifdef OF_HAVE_THREADS - OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]) == 0); + OF_ENSURE(OFSpinlockUnlock(&spinlocks[hash]) == 0); #endif return; } @@ -138,15 +138,15 @@ { if (atomic) { #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(src); - OF_ENSURE(of_spinlock_lock(&spinlocks[hash]) == 0); + OF_ENSURE(OFSpinlockLock(&spinlocks[hash]) == 0); #endif memcpy(dest, src, size); #ifdef OF_HAVE_THREADS - OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]) == 0); + OF_ENSURE(OFSpinlockUnlock(&spinlocks[hash]) == 0); #endif return; }