Index: src/exceptions/OFException.m ================================================================== --- src/exceptions/OFException.m +++ src/exceptions/OFException.m @@ -27,19 +27,20 @@ #endif #import "OFException.h" #import "OFArray.h" #import "OFLocale.h" -#ifdef OF_HAVE_THREADS -# import "OFMutex.h" -#endif #import "OFString.h" #import "OFSystemInfo.h" #import "OFInitializationFailedException.h" #import "OFLockFailedException.h" #import "OFUnlockFailedException.h" + +#ifdef OF_HAVE_THREADS +# import "mutex.h" +#endif #if defined(OF_WINDOWS) && defined(OF_HAVE_SOCKETS) # include #endif @@ -68,20 +69,20 @@ extern int _Unwind_VRS_Get(struct _Unwind_Context *, int, uint32_t, int, void *); #endif #if !defined(HAVE_STRERROR_R) && defined(OF_HAVE_THREADS) -static OFMutex *mutex; +static of_mutex_t mutex; OF_CONSTRUCTOR() { - mutex = [[OFMutex alloc] init]; + OF_ENSURE(of_mutex_new(&mutex) == 0); } OF_DESTRUCTOR() { - [mutex release]; + of_mutex_free(&mutex); } #endif OFString * of_strerror(int errNo) @@ -190,19 +191,22 @@ ret = [OFString stringWithCString: buffer encoding: [OFLocale encoding]]; #else # ifdef OF_HAVE_THREADS - [mutex lock]; + if (of_mutex_lock(&mutex) != 0) + @throw [OFLockFailedException exception]; + @try { # endif ret = [OFString stringWithCString: strerror(errNo) encoding: [OFLocale encoding]]; # ifdef OF_HAVE_THREADS } @finally { - [mutex unlock]; + if (of_mutex_unlock(&mutex) != 0) + @throw [OFUnlockFailedException exception]; } # endif #endif return ret;