Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -20,10 +20,14 @@ # include # include #else # include #endif + +#if defined(OF_GNU_RUNTIME) || defined(OF_OLD_GNU_RUNTIME) +# import +#endif #import "OFThread.h" #import "OFList.h" #import "OFDate.h" #import "OFAutoreleasePool.h" @@ -49,10 +53,14 @@ static of_tlskey_t thread_self; static id call_main(id obj) { +#ifndef OF_APPLE_RUNTIME + objc_thread_add(); +#endif + if (!of_tlskey_set(thread_self, obj)) @throw [OFInitializationFailedException newWithClass: [obj class]]; /* @@ -67,10 +75,14 @@ [OFTLSKey callAllDestructors]; [OFAutoreleasePool releaseAll]; [obj release]; + +#ifndef OF_APPLE_RUNTIME + objc_thread_remove(); +#endif return 0; } @implementation OFThread @@ -206,10 +218,14 @@ [OFTLSKey callAllDestructors]; [OFAutoreleasePool releaseAll]; [thread release]; + +#ifndef OF_APPLE_RUNTIME + objc_thread_remove(); +#endif of_thread_exit(); } - initWithObject: (id)obj @@ -242,11 +258,11 @@ { if (running == OF_THREAD_RUNNING) @throw [OFThreadStillRunningException newWithClass: isa thread: self]; - if (running = OF_THREAD_WAITING_FOR_JOIN) { + if (running == OF_THREAD_WAITING_FOR_JOIN) { of_thread_detach(thread); [retval release]; } [self retain];