@@ -24,11 +24,11 @@ #import "ObjFWRT.h" #import "private.h" #import "macros.h" #ifdef OF_HAVE_THREADS -# include "mutex.h" +# include "OFPlainMutex.h" #endif #ifdef HAVE_SEH_EXCEPTIONS # include #endif @@ -240,15 +240,15 @@ #endif static objc_uncaught_exception_handler_t uncaughtExceptionHandler; static struct objc_exception emergencyExceptions[NUM_EMERGENCY_EXCEPTIONS]; #ifdef OF_HAVE_THREADS -static of_spinlock_t emergencyExceptionsSpinlock; +static OFSpinlock emergencyExceptionsSpinlock; OF_CONSTRUCTOR() { - if (of_spinlock_new(&emergencyExceptionsSpinlock) != 0) + if (OFSpinlockNew(&emergencyExceptionsSpinlock) != 0) OBJC_ERROR("Cannot create spinlock!"); } #endif static uint64_t @@ -336,11 +336,11 @@ { uint64_t value; if (enc == DW_EH_PE_aligned) { const uintptr_t *aligned = (const uintptr_t *) - OF_ROUND_UP_POW2(sizeof(void *), (uintptr_t)*ptr); + OFRoundUpToPowerOf2(sizeof(void *), (uintptr_t)*ptr); *ptr = (const uint8_t *)(aligned + 1); return *aligned; } @@ -709,18 +709,18 @@ static void emergencyExceptionCleanup(_Unwind_Reason_Code reason, struct _Unwind_Exception *ex) { #ifdef OF_HAVE_THREADS - if (of_spinlock_lock(&emergencyExceptionsSpinlock) != 0) + if (OFSpinlockLock(&emergencyExceptionsSpinlock) != 0) OBJC_ERROR("Cannot lock spinlock!"); #endif ex->class = 0; #ifdef OF_HAVE_THREADS - if (of_spinlock_unlock(&emergencyExceptionsSpinlock) != 0) + if (OFSpinlockUnlock(&emergencyExceptionsSpinlock) != 0) OBJC_ERROR("Cannot unlock spinlock!"); #endif } void @@ -729,11 +729,11 @@ struct objc_exception *e = calloc(1, sizeof(*e)); bool emergency = false; if (e == NULL) { #ifdef OF_HAVE_THREADS - if (of_spinlock_lock(&emergencyExceptionsSpinlock) != 0) + if (OFSpinlockLock(&emergencyExceptionsSpinlock) != 0) OBJC_ERROR("Cannot lock spinlock!"); #endif for (uint_fast8_t i = 0; i < NUM_EMERGENCY_EXCEPTIONS; i++) { if (emergencyExceptions[i].exception.class == 0) { @@ -744,11 +744,11 @@ break; } } #ifdef OF_HAVE_THREADS - if (of_spinlock_unlock(&emergencyExceptionsSpinlock) != 0) + if (OFSpinlockUnlock(&emergencyExceptionsSpinlock) != 0) OBJC_ERROR("Cannot lock spinlock!"); #endif } if (e == NULL)