@@ -19,11 +19,13 @@ #include #include #import "runtime.h" #import "runtime-private.h" -#import "threading.h" + +#ifdef OF_THREADS +# import "threading.h" struct lock_s { id object; int count; of_rmutex_t rmutex; @@ -36,14 +38,16 @@ init(void) { if (!of_mutex_new(&mutex)) OBJC_ERROR("Failed to create mutex!") } +#endif int objc_sync_enter(id object) { +#ifdef OF_THREADS struct lock_s *lock; if (!of_mutex_lock(&mutex)) OBJC_ERROR("Failed to lock mutex!"); @@ -79,17 +83,19 @@ if (!of_mutex_unlock(&mutex)) OBJC_ERROR("Failed to unlock mutex!"); if (!of_rmutex_lock(&lock->rmutex)) OBJC_ERROR("Failed to lock mutex!"); +#endif return 0; } int objc_sync_exit(id object) { +#ifdef OF_THREADS struct lock_s *lock, *last = NULL; if (!of_mutex_lock(&mutex)) OBJC_ERROR("Failed to lock mutex!"); @@ -119,6 +125,9 @@ return 0; } OBJC_ERROR("objc_sync_exit() was called for an object not locked!"); +#else + return 0; +#endif }